﻿// $ANTLR 3.2 Sep 23, 2009 12:02:23 C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g 2010-04-21 16:26:17

// The variable 'variable' is assigned but its value is never used.
#pragma warning disable 168, 219
// Unreachable code detected.
#pragma warning disable 162


using System.Collections.Generic;
using System.Diagnostics;
using System.Text;


using System;
using Antlr.Runtime;
using Antlr.Runtime.Tree;using IList 		= System.Collections.IList;
using ArrayList 	= System.Collections.ArrayList;
using Stack 		= Antlr.Runtime.Collections.StackList;

using IDictionary	= System.Collections.IDictionary;
using Hashtable 	= System.Collections.Hashtable;
namespace 
	SqlAntlr

{
/**
 * TODO
 * - refactor rowset, selectQuery, and view
 * - add normalization
 * - handle function and aggregate
 */
public partial class SqlResolve : TreeParser
{
    public static readonly string[] tokenNames = new string[] 
	{
        "<invalid>", 
		"<EOR>", 
		"<DOWN>", 
		"<UP>", 
		"ALIAS", 
		"ARG", 
		"ARRAY", 
		"COMP", 
		"CONSTANT", 
		"CURRENCY", 
		"DECIMAL", 
		"GROUPBY", 
		"HEXADECIMAL", 
		"HINT", 
		"NOARG", 
		"OBJECT", 
		"ORDERBY", 
		"QUERY", 
		"QUERYSPEC", 
		"R", 
		"REAL", 
		"SELECTITEM", 
		"SIGN_MINUS", 
		"SIGN_PLUS", 
		"STRING", 
		"SUBQUERY", 
		"SYSVAR", 
		"TABLE", 
		"TABLECOLS", 
		"TABLEFUNCTION", 
		"TYPE", 
		"VARASSIGN", 
		"ADD", 
		"ALL", 
		"ALTER", 
		"AND", 
		"ANY", 
		"AS", 
		"ASC", 
		"AUTHORIZATION", 
		"AUTO", 
		"BACKUP", 
		"BASE64", 
		"BEGIN", 
		"BETWEEN", 
		"BINARY", 
		"BREAK", 
		"BROWSE", 
		"BULK", 
		"BY", 
		"CASCADE", 
		"CASE", 
		"CAST", 
		"CHECK", 
		"CHECKPOINT", 
		"CLOSE", 
		"CLUSTERED", 
		"COLLATE", 
		"COLUMN", 
		"COMMIT", 
		"COMPUTE", 
		"CONCAT", 
		"CONSTRAINT", 
		"CONTAINS", 
		"CONTAINSTABLE", 
		"CONTINUE", 
		"CREATE", 
		"CROSS", 
		"CUBE", 
		"CURRENT", 
		"CURRENT_DATE", 
		"CURRENT_TIME", 
		"CURRENT_TIMESTAMP", 
		"CURRENT_USER", 
		"CURSOR", 
		"DATABASE", 
		"DBCC", 
		"DEALLOCATE", 
		"DECLARE", 
		"DEFAULT", 
		"DELETE", 
		"DENY", 
		"DESC", 
		"DISK", 
		"DISTINCT", 
		"DISTRIBUTED", 
		"DOUBLE", 
		"DROP", 
		"DUMP", 
		"ELEMENTS", 
		"ELSE", 
		"END", 
		"ERRLVL", 
		"ESCAPE", 
		"EXCEPT", 
		"EXEC", 
		"EXECUTE", 
		"EXISTS", 
		"EXIT", 
		"EXPAND", 
		"EXPLICIT", 
		"FAST", 
		"FASTFIRSTROW", 
		"FETCH", 
		"FILE", 
		"FILLFACTOR", 
		"FOR", 
		"FORCE", 
		"FOREIGN", 
		"FREETEXT", 
		"FREETEXTTABLE", 
		"FROM", 
		"FULL", 
		"FUNCTION", 
		"GOTO", 
		"GRANT", 
		"GROUP", 
		"HASH", 
		"HAVING", 
		"HOLDLOCK", 
		"IDENTITY", 
		"IDENTITY_INSERT", 
		"IDENTITYCOL", 
		"IF", 
		"IN", 
		"INDEX", 
		"INNER", 
		"INSERT", 
		"INTERSECT", 
		"INTO", 
		"IS", 
		"JOIN", 
		"KEEP", 
		"KEEPFIXED", 
		"KEY", 
		"KILL", 
		"LEFT", 
		"LIKE", 
		"LINENO", 
		"LOAD", 
		"LOOP", 
		"MAXDOP", 
		"MERGE", 
		"NATIONAL", 
		"NOCHECK", 
		"NOLOCK", 
		"NONCLUSTERED", 
		"NOT", 
		"NULL", 
		"OF", 
		"OFF", 
		"OFFSETS", 
		"ON", 
		"OPEN", 
		"OPENDATASOURCE", 
		"OPENQUERY", 
		"OPENROWSET", 
		"OPENXML", 
		"OPTION", 
		"OR", 
		"ORDER", 
		"OUTER", 
		"OVER", 
		"PAGLOCK", 
		"PERCENT", 
		"PLAN", 
		"PRECISION", 
		"PRIMARY", 
		"PRINT", 
		"PROC", 
		"PROCEDURE", 
		"PUBLIC", 
		"RAISERROR", 
		"RAW", 
		"READ", 
		"READCOMMITED", 
		"READPAST", 
		"READTEXT", 
		"READUNCOMMITED", 
		"RECONFIGURE", 
		"REFERENCES", 
		"REMOTE", 
		"REPEATABLEREAD", 
		"REPLICATION", 
		"RESTORE", 
		"RESTRICT", 
		"RETURN", 
		"REVOKE", 
		"RIGHT", 
		"ROBUST", 
		"ROLLBACK", 
		"ROLLUP", 
		"ROWCOUNT", 
		"ROWGUIDCOL", 
		"ROWLOCK", 
		"RULE", 
		"SAVE", 
		"SCHEMA", 
		"SELECT", 
		"SERIALIZABLE", 
		"SESSION_USER", 
		"SET", 
		"SETUSER", 
		"SHUTDOWN", 
		"SOME", 
		"STATISTICS", 
		"SYSTEM_USER", 
		"TABLOCK", 
		"TABLOCKX", 
		"TEXTSIZE", 
		"THEN", 
		"TIES", 
		"TO", 
		"TOP", 
		"TRAN", 
		"TRANSACTION", 
		"TRIGGER", 
		"TRUNCATE", 
		"TSEQUAL", 
		"UNION", 
		"UNIQUE", 
		"UPDATE", 
		"UPDATETEXT", 
		"UPDLOCK", 
		"USE", 
		"USER", 
		"VALUES", 
		"VARYING", 
		"VIEW", 
		"VIEWS", 
		"WAITFOR", 
		"WHEN", 
		"WHERE", 
		"WHILE", 
		"WITH", 
		"WRITETEXT", 
		"XLOCK", 
		"XML", 
		"XMLDATA", 
		"F_CONNECTIONS", 
		"F_CPU_BUSY", 
		"F_CURSOR_ROWS", 
		"F_DATEFIRST", 
		"F_DBTS", 
		"F_ERROR", 
		"F_FETCH_STATUS", 
		"F_IDENTITY", 
		"F_IDLE", 
		"F_IO_BUSY", 
		"F_LANGID", 
		"F_LANGUAGE", 
		"F_LOCK_TIMEOUT", 
		"F_MAX_CONNECTIONS", 
		"F_MAX_PRECISION", 
		"F_NESTLEVEL", 
		"F_OPTIONS", 
		"F_PACK_RECEIVED", 
		"F_PACK_SENT", 
		"F_PACKET_ERRORS", 
		"F_PROCID", 
		"F_REMSERVER", 
		"F_ROWCOUNT", 
		"F_SERVERNAME", 
		"F_SERVICENAME", 
		"F_SPID", 
		"F_TEXTSIZE", 
		"F_TIMETICKS", 
		"F_TOTAL_ERRORS", 
		"F_TOTAL_READ", 
		"F_TOTAL_WRITE", 
		"F_TRANCOUNT", 
		"F_VERSION", 
		"SEMICOLON", 
		"LPAREN", 
		"RPAREN", 
		"COMMA", 
		"Integer", 
		"STAR", 
		"Variable", 
		"COLON", 
		"ASSIGNEQUAL", 
		"DOT_STAR", 
		"PLUS", 
		"MINUS", 
		"AMPERSAND", 
		"BITWISEOR", 
		"BITWISEXOR", 
		"DIVIDE", 
		"MOD", 
		"DOT", 
		"UnicodeStringLiteral", 
		"ASCIIStringLiteral", 
		"NonQuotedIdentifier", 
		"QuotedIdentifier", 
		"Real", 
		"HexLiteral", 
		"Currency", 
		"ODBCDateTime", 
		"TILDE", 
		"NOTEQUAL1", 
		"NOTEQUAL2", 
		"LESSTHANOREQUALTO1", 
		"LESSTHANOREQUALTO2", 
		"LESSTHAN", 
		"GREATERTHANOREQUALTO1", 
		"GREATERTHANOREQUALTO2", 
		"GREATERTHAN", 
		"Whitespace", 
		"SingleLineComment", 
		"FRAG_ML_COMMENT", 
		"MultiLineComment", 
		"Letter", 
		"Digit", 
		"Exponent", 
		"Number"
    };

    public const int FUNCTION = 113;
    public const int FREETEXT = 109;
    public const int STAR = 277;
    public const int MOD = 288;
    public const int PRECISION = 166;
    public const int CONTAINS = 63;
    public const int IDENTITYCOL = 122;
    public const int F_LANGUAGE = 250;
    public const int F_PACKET_ERRORS = 258;
    public const int CHECKPOINT = 54;
    public const int NOT = 147;
    public const int ASSIGNEQUAL = 280;
    public const int EXCEPT = 94;
    public const int OPENROWSET = 156;
    public const int FOREIGN = 108;
    public const int EOF = -1;
    public const int KILL = 135;
    public const int ROWGUIDCOL = 193;
    public const int F_ERROR = 244;
    public const int TYPE = 30;
    public const int RPAREN = 274;
    public const int CREATE = 66;
    public const int ARG = 5;
    public const int OFF = 150;
    public const int BEGIN = 43;
    public const int LOOP = 140;
    public const int WRITETEXT = 235;
    public const int RETURN = 186;
    public const int TABLEFUNCTION = 29;
    public const int NonQuotedIdentifier = 292;
    public const int GOTO = 114;
    public const int XMLDATA = 238;
    public const int DIVIDE = 287;
    public const int NOARG = 14;
    public const int ASC = 38;
    public const int UnicodeStringLiteral = 290;
    public const int TRANSACTION = 215;
    public const int KEY = 134;
    public const int F_DATEFIRST = 242;
    public const int ELSE = 90;
    public const int LOAD = 139;
    public const int BROWSE = 47;
    public const int SEMICOLON = 272;
    public const int FASTFIRSTROW = 102;
    public const int R = 19;
    public const int ROLLBACK = 190;
    public const int FILE = 104;
    public const int RESTRICT = 185;
    public const int F_ROWCOUNT = 261;
    public const int READTEXT = 177;
    public const int REAL = 20;
    public const int INTERSECT = 128;
    public const int GROUP = 116;
    public const int TABLECOLS = 28;
    public const int F_CPU_BUSY = 240;
    public const int PLAN = 165;
    public const int FETCH = 103;
    public const int F_REMSERVER = 260;
    public const int READ = 174;
    public const int RECONFIGURE = 179;
    public const int ALIAS = 4;
    public const int USER = 225;
    public const int CONSTANT = 8;
    public const int F_SERVICENAME = 263;
    public const int VARASSIGN = 31;
    public const int SHUTDOWN = 203;
    public const int SYSTEM_USER = 206;
    public const int HINT = 13;
    public const int END = 91;
    public const int CONSTRAINT = 62;
    public const int XML = 237;
    public const int REPLICATION = 183;
    public const int ALTER = 34;
    public const int SIGN_MINUS = 22;
    public const int OPTION = 158;
    public const int IDENTITY = 120;
    public const int FORCE = 107;
    public const int CURRENT_USER = 73;
    public const int EXECUTE = 96;
    public const int FREETEXTTABLE = 110;
    public const int TABLE = 27;
    public const int SESSION_USER = 200;
    public const int F_TOTAL_ERRORS = 267;
    public const int SYSVAR = 26;
    public const int ORDERBY = 16;
    public const int EXPLICIT = 100;
    public const int LPAREN = 273;
    public const int SUBQUERY = 25;
    public const int AS = 37;
    public const int F_PROCID = 259;
    public const int MAXDOP = 141;
    public const int THEN = 210;
    public const int XLOCK = 236;
    public const int LEFT = 136;
    public const int TRUNCATE = 217;
    public const int DUMP = 88;
    public const int F_SPID = 264;
    public const int COLUMN = 58;
    public const int AUTO = 40;
    public const int Real = 294;
    public const int PLUS = 282;
    public const int EXISTS = 97;
    public const int MultiLineComment = 310;
    public const int ROWCOUNT = 192;
    public const int LIKE = 137;
    public const int COLLATE = 57;
    public const int ADD = 32;
    public const int HexLiteral = 295;
    public const int OUTER = 161;
    public const int REMOTE = 181;
    public const int LESSTHAN = 303;
    public const int BY = 49;
    public const int IDENTITY_INSERT = 121;
    public const int SERIALIZABLE = 199;
    public const int TO = 212;
    public const int MERGE = 142;
    public const int QUERYSPEC = 18;
    public const int AMPERSAND = 284;
    public const int FAST = 101;
    public const int SET = 201;
    public const int RIGHT = 188;
    public const int EXEC = 95;
    public const int HAVING = 118;
    public const int F_VERSION = 271;
    public const int MINUS = 283;
    public const int UPDATETEXT = 222;
    public const int QuotedIdentifier = 293;
    public const int TSEQUAL = 218;
    public const int BITWISEOR = 285;
    public const int PRINT = 168;
    public const int F_TRANCOUNT = 270;
    public const int UNION = 219;
    public const int CURRENT = 69;
    public const int NOCHECK = 144;
    public const int COLON = 279;
    public const int COMMIT = 59;
    public const int SCHEMA = 197;
    public const int DATABASE = 75;
    public const int CLOSE = 55;
    public const int DECIMAL = 10;
    public const int HOLDLOCK = 119;
    public const int DROP = 87;
    public const int ROWLOCK = 194;
    public const int WHEN = 231;
    public const int FILLFACTOR = 105;
    public const int RAISERROR = 172;
    public const int DECLARE = 78;
    public const int F_LOCK_TIMEOUT = 251;
    public const int REVOKE = 187;
    public const int BULK = 48;
    public const int PUBLIC = 171;
    public const int BETWEEN = 44;
    public const int Integer = 276;
    public const int STRING = 24;
    public const int TABLOCKX = 208;
    public const int CAST = 52;
    public const int ROBUST = 189;
    public const int CONTAINSTABLE = 64;
    public const int CLUSTERED = 56;
    public const int REPEATABLEREAD = 182;
    public const int F_MAX_PRECISION = 253;
    public const int WHILE = 233;
    public const int GREATERTHANOREQUALTO2 = 305;
    public const int COMPUTE = 60;
    public const int GREATERTHANOREQUALTO1 = 304;
    public const int VARYING = 227;
    public const int DOT_STAR = 281;
    public const int TRIGGER = 216;
    public const int CURRENT_TIME = 71;
    public const int CASE = 51;
    public const int BITWISEXOR = 286;
    public const int DEALLOCATE = 77;
    public const int TRAN = 214;
    public const int CASCADE = 50;
    public const int BREAK = 46;
    public const int Currency = 296;
    public const int SELECTITEM = 21;
    public const int F_PACK_RECEIVED = 256;
    public const int ASCIIStringLiteral = 291;
    public const int Variable = 278;
    public const int FULL = 112;
    public const int PAGLOCK = 163;
    public const int ESCAPE = 93;
    public const int INSERT = 127;
    public const int DOUBLE = 86;
    public const int SIGN_PLUS = 23;
    public const int F_NESTLEVEL = 254;
    public const int SELECT = 198;
    public const int INTO = 129;
    public const int ARRAY = 6;
    public const int GROUPBY = 11;
    public const int GREATERTHAN = 306;
    public const int EXIT = 98;
    public const int READPAST = 176;
    public const int SETUSER = 202;
    public const int F_IDLE = 247;
    public const int UNIQUE = 220;
    public const int RESTORE = 184;
    public const int RULE = 195;
    public const int VIEW = 228;
    public const int CONCAT = 61;
    public const int FRAG_ML_COMMENT = 309;
    public const int ROLLUP = 191;
    public const int NULL = 148;
    public const int LESSTHANOREQUALTO2 = 302;
    public const int WAITFOR = 230;
    public const int ON = 152;
    public const int PRIMARY = 167;
    public const int DELETE = 80;
    public const int OF = 149;
    public const int BACKUP = 41;
    public const int OPENQUERY = 155;
    public const int F_TIMETICKS = 266;
    public const int DENY = 81;
    public const int CUBE = 68;
    public const int NATIONAL = 143;
    public const int STATISTICS = 205;
    public const int OR = 159;
    public const int QUERY = 17;
    public const int LESSTHANOREQUALTO1 = 301;
    public const int OPENDATASOURCE = 154;
    public const int CURRENCY = 9;
    public const int CHECK = 53;
    public const int BASE64 = 42;
    public const int UPDLOCK = 223;
    public const int USE = 224;
    public const int KEEPFIXED = 133;
    public const int FROM = 111;
    public const int F_IDENTITY = 246;
    public const int CURSOR = 74;
    public const int DISTINCT = 84;
    public const int Letter = 311;
    public const int CURRENT_DATE = 70;
    public const int OVER = 162;
    public const int WHERE = 232;
    public const int INNER = 126;
    public const int SingleLineComment = 308;
    public const int ORDER = 160;
    public const int AUTHORIZATION = 39;
    public const int F_MAX_CONNECTIONS = 252;
    public const int F_IO_BUSY = 248;
    public const int UPDATE = 221;
    public const int F_CURSOR_ROWS = 241;
    public const int OFFSETS = 151;
    public const int FOR = 106;
    public const int DISTRIBUTED = 85;
    public const int Exponent = 313;
    public const int F_CONNECTIONS = 239;
    public const int OPENXML = 157;
    public const int AND = 35;
    public const int EXPAND = 99;
    public const int CROSS = 67;
    public const int IF = 123;
    public const int INDEX = 125;
    public const int F_TOTAL_READ = 268;
    public const int RAW = 173;
    public const int F_DBTS = 243;
    public const int F_TOTAL_WRITE = 269;
    public const int IN = 124;
    public const int F_SERVERNAME = 262;
    public const int Number = 314;
    public const int OBJECT = 15;
    public const int CONTINUE = 65;
    public const int REFERENCES = 180;
    public const int COMMA = 275;
    public const int IS = 130;
    public const int SOME = 204;
    public const int ALL = 33;
    public const int PROC = 169;
    public const int TILDE = 298;
    public const int TABLOCK = 207;
    public const int F_FETCH_STATUS = 245;
    public const int F_TEXTSIZE = 265;
    public const int DOT = 289;
    public const int CURRENT_TIMESTAMP = 72;
    public const int Whitespace = 307;
    public const int TIES = 211;
    public const int NOLOCK = 145;
    public const int WITH = 234;
    public const int VIEWS = 229;
    public const int LINENO = 138;
    public const int GRANT = 115;
    public const int PERCENT = 164;
    public const int TEXTSIZE = 209;
    public const int DEFAULT = 79;
    public const int VALUES = 226;
    public const int HASH = 117;
    public const int HEXADECIMAL = 12;
    public const int SAVE = 196;
    public const int ERRLVL = 92;
    public const int COMP = 7;
    public const int Digit = 312;
    public const int ELEMENTS = 89;
    public const int PROCEDURE = 170;
    public const int JOIN = 131;
    public const int OPEN = 153;
    public const int F_OPTIONS = 255;
    public const int ANY = 36;
    public const int NONCLUSTERED = 146;
    public const int DISK = 83;
    public const int ODBCDateTime = 297;
    public const int KEEP = 132;
    public const int F_PACK_SENT = 257;
    public const int NOTEQUAL1 = 299;
    public const int NOTEQUAL2 = 300;
    public const int F_LANGID = 249;
    public const int BINARY = 45;
    public const int DESC = 82;
    public const int READCOMMITED = 175;
    public const int TOP = 213;
    public const int DBCC = 76;
    public const int READUNCOMMITED = 178;

    // delegates
    // delegators



        public SqlResolve(ITreeNodeStream input)
    		: this(input, new RecognizerSharedState()) {
        }

        public SqlResolve(ITreeNodeStream input, RecognizerSharedState state)
    		: base(input, state) {
            InitializeCyclicDFAs();
            this.state.ruleMemo = new Hashtable[255+1];
             
             
        }
        

    override public string[] TokenNames {
		get { return SqlResolve.tokenNames; }
    }

    override public string GrammarFileName {
		get { return "C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g"; }
    }



    //private static Logger logger = Logger.getLogger("cqms.common.sqlparser.SqlResolve");

    private DBSchema schema;
    private SqlQuery current;
    private SqlQuery.Resolver resolver;
    private ITokenStream tokenStream;
    private int errors;

    private Dictionary<CommonTree,Column> colIndex = new Dictionary<CommonTree,Column>();
    private Dictionary<CommonTree,IView> viewIndex = new Dictionary<CommonTree,IView>();

    public void setSchema(DBSchema s) { schema = s; }
    public void setQuery(SqlQuery q) { current = q; }
    public void setResolver(SqlQuery.Resolver r) { resolver = r; }
    public void setTokenStream(ITokenStream s) { tokenStream = s; }

    public DBSchema getSchema() { return schema; }
    public ITokenStream getTokenStream() { return tokenStream; }
    public Dictionary<CommonTree,Column> getColumnIndex() {
        return new Dictionary<CommonTree,Column>(colIndex);
    }
    public Dictionary<CommonTree,IView> getViewIndex() {
        return new Dictionary<CommonTree, IView>(viewIndex);
    }

    public override void Reset() {
        errors += NumberOfSyntaxErrors;
        base.Reset();
    }

    /**
     * clear accumulated parse error counter and column object cache
     */
    public void Clear() {
        errors = 0;
        colIndex.Clear();
        viewIndex.Clear();
    }
    public int getTotalErrors() { return errors; }

    protected override object RecoverFromMismatchedToken(IIntStream input, int ttype, BitSet follow)
    {
        throw new MismatchedTokenException(ttype, input);
    }

    public override Object RecoverFromMismatchedSet(IIntStream input,RecognitionException e,BitSet follow)
    {
        throw e;
    }



    public class subQuery_return : TreeRuleReturnScope
    {
    };

    // $ANTLR start "subQuery"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:89:1: subQuery : ^( QUERY ( . )+ ) ;
    public SqlResolve.subQuery_return subQuery() // throws RecognitionException [1]
    {   
        SqlResolve.subQuery_return retval = new SqlResolve.subQuery_return();
        retval.Start = input.LT(1);
        int subQuery_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 1) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:90:5: ( ^( QUERY ( . )+ ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:90:7: ^( QUERY ( . )+ )
            {
            	Match(input,QUERY,FOLLOW_QUERY_in_subQuery97); if (state.failed) return retval;

            	Match(input, Token.DOWN, null); if (state.failed) return retval;
            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:90:15: ( . )+
            	int cnt1 = 0;
            	do 
            	{
            	    int alt1 = 2;
            	    int LA1_0 = input.LA(1);

            	    if ( ((LA1_0 >= ALIAS && LA1_0 <= Number)) )
            	    {
            	        alt1 = 1;
            	    }


            	    switch (alt1) 
            		{
            			case 1 :
            			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: .
            			    {
            			    	MatchAny(input); if (state.failed) return retval;

            			    }
            			    break;

            			default:
            			    if ( cnt1 >= 1 ) goto loop1;
            			    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            		            EarlyExitException eee1 =
            		                new EarlyExitException(1, input);
            		            throw eee1;
            	    }
            	    cnt1++;
            	} while (true);

            	loop1:
            		;	// Stops C# compiler whining that label 'loop1' has no statements


            	Match(input, Token.UP, null); if (state.failed) return retval;

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 1, subQuery_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "subQuery"


    // $ANTLR start "array"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:93:1: array returns [Column result] : ^( ARRAY ( argExpr[arr] )+ ) ;
    public Column array() // throws RecognitionException [1]
    {   
        Column result = default(Column);
        int array_StartIndex = input.Index();
        CommonTree ARRAY1 = null;


                IList<Column> arr = new List<Column>();
            
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 2) ) 
    	    {
    	    	return result; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:97:5: ( ^( ARRAY ( argExpr[arr] )+ ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:97:7: ^( ARRAY ( argExpr[arr] )+ )
            {
            	ARRAY1=(CommonTree)Match(input,ARRAY,FOLLOW_ARRAY_in_array132); if (state.failed) return result;

            	Match(input, Token.DOWN, null); if (state.failed) return result;
            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:97:15: ( argExpr[arr] )+
            	int cnt2 = 0;
            	do 
            	{
            	    int alt2 = 2;
            	    int LA2_0 = input.LA(1);

            	    if ( (LA2_0 == ARRAY || LA2_0 == CONSTANT || LA2_0 == OBJECT || LA2_0 == QUERY || (LA2_0 >= SIGN_MINUS && LA2_0 <= SIGN_PLUS) || (LA2_0 >= CASE && LA2_0 <= CAST) || (LA2_0 >= CURRENT_TIMESTAMP && LA2_0 <= CURRENT_USER) || LA2_0 == FUNCTION || LA2_0 == SESSION_USER || LA2_0 == SYSTEM_USER || (LA2_0 >= STAR && LA2_0 <= Variable) || (LA2_0 >= PLUS && LA2_0 <= MOD) || LA2_0 == TILDE) )
            	    {
            	        alt2 = 1;
            	    }


            	    switch (alt2) 
            		{
            			case 1 :
            			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: argExpr[arr]
            			    {
            			    	PushFollow(FOLLOW_argExpr_in_array134);
            			    	argExpr(arr);
            			    	state.followingStackPointer--;
            			    	if (state.failed) return result;

            			    }
            			    break;

            			default:
            			    if ( cnt2 >= 1 ) goto loop2;
            			    if ( state.backtracking > 0 ) {state.failed = true; return result;}
            		            EarlyExitException eee2 =
            		                new EarlyExitException(2, input);
            		            throw eee2;
            	    }
            	    cnt2++;
            	} while (true);

            	loop2:
            		;	// Stops C# compiler whining that label 'loop2' has no statements


            	Match(input, Token.UP, null); if (state.failed) return result;
            	if ( (state.backtracking==0) )
            	{

            	          result =  new Column.Array(current,ARRAY1,arr);
            	          colIndex[ARRAY1] = result;
            	      
            	}

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 2, array_StartIndex); 
            }
        }
        return result;
    }
    // $ANTLR end "array"

    public class argExpr_return : TreeRuleReturnScope
    {
        public Column result;
    };

    // $ANTLR start "argExpr"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:104:1: argExpr[IList<Column> l] returns [Column result] : ( dbObject | subQuery | function | ^( CASE ( resolve_expr )? ( resolve_caseWhen )+ ( resolve_caseElse )? ) | ^( CAST resolve_expr identifier ( Integer ( Integer )? )? ) | parameterlessFunction | ^( CONSTANT constant ) | Variable | ^( PLUS resolve_expr resolve_expr ) | ^( MINUS resolve_expr resolve_expr ) | ^( STAR resolve_expr resolve_expr ) | ^( DIVIDE resolve_expr resolve_expr ) | ^( MOD resolve_expr resolve_expr ) | ^( AMPERSAND resolve_expr resolve_expr ) | ^( BITWISEOR resolve_expr resolve_expr ) | ^( BITWISEXOR resolve_expr resolve_expr ) | ^( TILDE resolve_expr ) | ^( SIGN_PLUS resolve_expr ) | ^( SIGN_MINUS resolve_expr ) | array );
    public SqlResolve.argExpr_return argExpr(IList<Column> l) // throws RecognitionException [1]
    {   
        SqlResolve.argExpr_return retval = new SqlResolve.argExpr_return();
        retval.Start = input.LT(1);
        int argExpr_StartIndex = input.Index();
        CommonTree CASE5 = null;
        CommonTree CAST6 = null;
        CommonTree Variable9 = null;
        CommonTree PLUS10 = null;
        CommonTree MINUS11 = null;
        CommonTree STAR12 = null;
        CommonTree DIVIDE13 = null;
        CommonTree MOD14 = null;
        CommonTree AMPERSAND15 = null;
        CommonTree BITWISEOR16 = null;
        CommonTree BITWISEXOR17 = null;
        CommonTree TILDE18 = null;
        CommonTree SIGN_PLUS19 = null;
        CommonTree SIGN_MINUS20 = null;
        SqlResolve.dbObject_return dbObject2 = default(SqlResolve.dbObject_return);

        SqlResolve.subQuery_return subQuery3 = default(SqlResolve.subQuery_return);

        SqlResolve.function_return function4 = default(SqlResolve.function_return);

        SqlResolve.parameterlessFunction_return parameterlessFunction7 = default(SqlResolve.parameterlessFunction_return);

        SqlResolve.constant_return constant8 = default(SqlResolve.constant_return);

        Column array21 = default(Column);



                Column arg = null;
            
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 3) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:112:5: ( dbObject | subQuery | function | ^( CASE ( resolve_expr )? ( resolve_caseWhen )+ ( resolve_caseElse )? ) | ^( CAST resolve_expr identifier ( Integer ( Integer )? )? ) | parameterlessFunction | ^( CONSTANT constant ) | Variable | ^( PLUS resolve_expr resolve_expr ) | ^( MINUS resolve_expr resolve_expr ) | ^( STAR resolve_expr resolve_expr ) | ^( DIVIDE resolve_expr resolve_expr ) | ^( MOD resolve_expr resolve_expr ) | ^( AMPERSAND resolve_expr resolve_expr ) | ^( BITWISEOR resolve_expr resolve_expr ) | ^( BITWISEXOR resolve_expr resolve_expr ) | ^( TILDE resolve_expr ) | ^( SIGN_PLUS resolve_expr ) | ^( SIGN_MINUS resolve_expr ) | array )
            int alt8 = 20;
            switch ( input.LA(1) ) 
            {
            case OBJECT:
            	{
                alt8 = 1;
                }
                break;
            case QUERY:
            	{
                alt8 = 2;
                }
                break;
            case FUNCTION:
            	{
                alt8 = 3;
                }
                break;
            case CASE:
            	{
                alt8 = 4;
                }
                break;
            case CAST:
            	{
                alt8 = 5;
                }
                break;
            case CURRENT_TIMESTAMP:
            case CURRENT_USER:
            case SESSION_USER:
            case SYSTEM_USER:
            	{
                alt8 = 6;
                }
                break;
            case CONSTANT:
            	{
                alt8 = 7;
                }
                break;
            case Variable:
            	{
                alt8 = 8;
                }
                break;
            case PLUS:
            	{
                alt8 = 9;
                }
                break;
            case MINUS:
            	{
                alt8 = 10;
                }
                break;
            case STAR:
            	{
                alt8 = 11;
                }
                break;
            case DIVIDE:
            	{
                alt8 = 12;
                }
                break;
            case MOD:
            	{
                alt8 = 13;
                }
                break;
            case AMPERSAND:
            	{
                alt8 = 14;
                }
                break;
            case BITWISEOR:
            	{
                alt8 = 15;
                }
                break;
            case BITWISEXOR:
            	{
                alt8 = 16;
                }
                break;
            case TILDE:
            	{
                alt8 = 17;
                }
                break;
            case SIGN_PLUS:
            	{
                alt8 = 18;
                }
                break;
            case SIGN_MINUS:
            	{
                alt8 = 19;
                }
                break;
            case ARRAY:
            	{
                alt8 = 20;
                }
                break;
            	default:
            	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            	    NoViableAltException nvae_d8s0 =
            	        new NoViableAltException("", 8, 0, input);

            	    throw nvae_d8s0;
            }

            switch (alt8) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:112:7: dbObject
                    {
                    	PushFollow(FOLLOW_dbObject_in_argExpr184);
                    	dbObject2 = dbObject();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          String[] x = (String[])((dbObject2 != null) ? dbObject2.obj : default(String[]));
                    	          String relName = ( x.Length > 1 ) ? x[x.Length - 2] : null;
                    	          String colName = x[x.Length - 1];

                    	          arg = resolver.resolve(relName,colName);
                    	          if ( arg == null )
                    	              throw new UnknownColumnException(string.Join(",", x));

                    	          //arg = new Column.Value(current,((dbObject2 != null) ? ((CommonTree)dbObject2.Start) : null),c);

                    	          // we don't instantiate a new column object for this.
                    	          // instead, just add a reference to the resolved column
                    	          colIndex[ ((dbObject2 != null) ? ((CommonTree)dbObject2.Start) : null) ] = arg ;
                    	      
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:128:7: subQuery
                    {
                    	PushFollow(FOLLOW_subQuery_in_argExpr198);
                    	subQuery3 = subQuery();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          // find r in given from result
                    	          SqlQuery q = current.getSubQuery(((subQuery3 != null) ? ((CommonTree)subQuery3.Start) : null));

                    	          if ( q == null )
                    	              throw new UnknownTableException("Unknown subquery: "+((subQuery3 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(subQuery3.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(subQuery3.Start)) : null));
                    	          //assert( q != null );
                    	          //assert( q.getCardinality() == 1 );

                    	          arg = new Column.Query(current,q);

                    	          colIndex[((subQuery3 != null) ? ((CommonTree)subQuery3.Start) : null)] = arg ;
                    	          viewIndex[((subQuery3 != null) ? ((CommonTree)subQuery3.Start) : null)] = q ;
                    	      
                    	}

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:143:7: function
                    {
                    	PushFollow(FOLLOW_function_in_argExpr212);
                    	function4 = function();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = ((function4 != null) ? function4.result : default(Column.Function));

                    	          colIndex[((function4 != null) ? ((CommonTree)function4.Start) : null)] = arg ;
                    	      
                    	}

                    }
                    break;
                case 4 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:149:7: ^( CASE ( resolve_expr )? ( resolve_caseWhen )+ ( resolve_caseElse )? )
                    {
                    	CASE5=(CommonTree)Match(input,CASE,FOLLOW_CASE_in_argExpr227); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:149:14: ( resolve_expr )?
                    	int alt3 = 2;
                    	int LA3_0 = input.LA(1);

                    	if ( (LA3_0 == ARRAY || LA3_0 == CONSTANT || LA3_0 == OBJECT || LA3_0 == QUERY || (LA3_0 >= SIGN_MINUS && LA3_0 <= SIGN_PLUS) || (LA3_0 >= CASE && LA3_0 <= CAST) || (LA3_0 >= CURRENT_TIMESTAMP && LA3_0 <= CURRENT_USER) || LA3_0 == FUNCTION || LA3_0 == SESSION_USER || LA3_0 == SYSTEM_USER || (LA3_0 >= STAR && LA3_0 <= Variable) || (LA3_0 >= PLUS && LA3_0 <= MOD) || LA3_0 == TILDE) )
                    	{
                    	    alt3 = 1;
                    	}
                    	switch (alt3) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: resolve_expr
                    	        {
                    	        	PushFollow(FOLLOW_resolve_expr_in_argExpr229);
                    	        	resolve_expr();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;

                    	        }
                    	        break;

                    	}

                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:149:28: ( resolve_caseWhen )+
                    	int cnt4 = 0;
                    	do 
                    	{
                    	    int alt4 = 2;
                    	    int LA4_0 = input.LA(1);

                    	    if ( (LA4_0 == WHEN) )
                    	    {
                    	        alt4 = 1;
                    	    }


                    	    switch (alt4) 
                    		{
                    			case 1 :
                    			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: resolve_caseWhen
                    			    {
                    			    	PushFollow(FOLLOW_resolve_caseWhen_in_argExpr232);
                    			    	resolve_caseWhen();
                    			    	state.followingStackPointer--;
                    			    	if (state.failed) return retval;

                    			    }
                    			    break;

                    			default:
                    			    if ( cnt4 >= 1 ) goto loop4;
                    			    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    		            EarlyExitException eee4 =
                    		                new EarlyExitException(4, input);
                    		            throw eee4;
                    	    }
                    	    cnt4++;
                    	} while (true);

                    	loop4:
                    		;	// Stops C# compiler whining that label 'loop4' has no statements

                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:149:46: ( resolve_caseElse )?
                    	int alt5 = 2;
                    	int LA5_0 = input.LA(1);

                    	if ( (LA5_0 == ELSE) )
                    	{
                    	    alt5 = 1;
                    	}
                    	switch (alt5) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: resolve_caseElse
                    	        {
                    	        	PushFollow(FOLLOW_resolve_caseElse_in_argExpr235);
                    	        	resolve_caseElse();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;

                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,CASE5);
                    	      
                    	}

                    }
                    break;
                case 5 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:153:7: ^( CAST resolve_expr identifier ( Integer ( Integer )? )? )
                    {
                    	CAST6=(CommonTree)Match(input,CAST,FOLLOW_CAST_in_argExpr252); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr254);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	PushFollow(FOLLOW_identifier_in_argExpr256);
                    	identifier();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:153:38: ( Integer ( Integer )? )?
                    	int alt7 = 2;
                    	int LA7_0 = input.LA(1);

                    	if ( (LA7_0 == Integer) )
                    	{
                    	    alt7 = 1;
                    	}
                    	switch (alt7) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:153:39: Integer ( Integer )?
                    	        {
                    	        	Match(input,Integer,FOLLOW_Integer_in_argExpr259); if (state.failed) return retval;
                    	        	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:153:47: ( Integer )?
                    	        	int alt6 = 2;
                    	        	int LA6_0 = input.LA(1);

                    	        	if ( (LA6_0 == Integer) )
                    	        	{
                    	        	    alt6 = 1;
                    	        	}
                    	        	switch (alt6) 
                    	        	{
                    	        	    case 1 :
                    	        	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: Integer
                    	        	        {
                    	        	        	Match(input,Integer,FOLLOW_Integer_in_argExpr261); if (state.failed) return retval;

                    	        	        }
                    	        	        break;

                    	        	}


                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,CAST6);
                    	      
                    	}

                    }
                    break;
                case 6 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:157:7: parameterlessFunction
                    {
                    	PushFollow(FOLLOW_parameterlessFunction_in_argExpr279);
                    	parameterlessFunction7 = parameterlessFunction();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Function(current,((parameterlessFunction7 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(parameterlessFunction7.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(parameterlessFunction7.Start)) : null));
                    	      
                    	}

                    }
                    break;
                case 7 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:161:7: ^( CONSTANT constant )
                    {
                    	Match(input,CONSTANT,FOLLOW_CONSTANT_in_argExpr294); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_constant_in_argExpr296);
                    	constant8 = constant();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Constant(current,((constant8 != null) ? ((CommonTree)constant8.Start) : null),((constant8 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(constant8.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(constant8.Start)) : null),((constant8 != null) ? constant8.result : default(Object)));
                    	      
                    	}

                    }
                    break;
                case 8 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:165:7: Variable
                    {
                    	Variable9=(CommonTree)Match(input,Variable,FOLLOW_Variable_in_argExpr311); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,Variable9);
                    	      
                    	}

                    }
                    break;
                case 9 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:169:7: ^( PLUS resolve_expr resolve_expr )
                    {
                    	PLUS10=(CommonTree)Match(input,PLUS,FOLLOW_PLUS_in_argExpr326); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr328);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr330);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,PLUS10);
                    	      
                    	}

                    }
                    break;
                case 10 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:173:7: ^( MINUS resolve_expr resolve_expr )
                    {
                    	MINUS11=(CommonTree)Match(input,MINUS,FOLLOW_MINUS_in_argExpr346); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr348);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr350);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,MINUS11);
                    	      
                    	}

                    }
                    break;
                case 11 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:177:7: ^( STAR resolve_expr resolve_expr )
                    {
                    	STAR12=(CommonTree)Match(input,STAR,FOLLOW_STAR_in_argExpr366); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr368);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr370);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,STAR12);
                    	      
                    	}

                    }
                    break;
                case 12 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:181:7: ^( DIVIDE resolve_expr resolve_expr )
                    {
                    	DIVIDE13=(CommonTree)Match(input,DIVIDE,FOLLOW_DIVIDE_in_argExpr386); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr388);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr390);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,DIVIDE13);
                    	      
                    	}

                    }
                    break;
                case 13 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:185:7: ^( MOD resolve_expr resolve_expr )
                    {
                    	MOD14=(CommonTree)Match(input,MOD,FOLLOW_MOD_in_argExpr406); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr408);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr410);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,MOD14);
                    	      
                    	}

                    }
                    break;
                case 14 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:189:7: ^( AMPERSAND resolve_expr resolve_expr )
                    {
                    	AMPERSAND15=(CommonTree)Match(input,AMPERSAND,FOLLOW_AMPERSAND_in_argExpr426); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr428);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr430);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,AMPERSAND15);
                    	      
                    	}

                    }
                    break;
                case 15 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:193:7: ^( BITWISEOR resolve_expr resolve_expr )
                    {
                    	BITWISEOR16=(CommonTree)Match(input,BITWISEOR,FOLLOW_BITWISEOR_in_argExpr446); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr448);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr450);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,BITWISEOR16);
                    	      
                    	}

                    }
                    break;
                case 16 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:197:7: ^( BITWISEXOR resolve_expr resolve_expr )
                    {
                    	BITWISEXOR17=(CommonTree)Match(input,BITWISEXOR,FOLLOW_BITWISEXOR_in_argExpr466); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr468);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr470);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,BITWISEXOR17);
                    	      
                    	}

                    }
                    break;
                case 17 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:201:7: ^( TILDE resolve_expr )
                    {
                    	TILDE18=(CommonTree)Match(input,TILDE,FOLLOW_TILDE_in_argExpr486); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr488);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,TILDE18);
                    	      
                    	}

                    }
                    break;
                case 18 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:205:7: ^( SIGN_PLUS resolve_expr )
                    {
                    	SIGN_PLUS19=(CommonTree)Match(input,SIGN_PLUS,FOLLOW_SIGN_PLUS_in_argExpr504); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr506);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,SIGN_PLUS19);
                    	      
                    	}

                    }
                    break;
                case 19 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:209:7: ^( SIGN_MINUS resolve_expr )
                    {
                    	SIGN_MINUS20=(CommonTree)Match(input,SIGN_MINUS,FOLLOW_SIGN_MINUS_in_argExpr522); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_resolve_expr_in_argExpr524);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = new Column.Expr(current,SIGN_MINUS20);
                    	      
                    	}

                    }
                    break;
                case 20 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:213:7: array
                    {
                    	PushFollow(FOLLOW_array_in_argExpr539);
                    	array21 = array();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          arg = array21;
                    	      
                    	}

                    }
                    break;

            }
            if ( (state.backtracking==0) )
            {

                      retval.result =  arg;
                      if ( l != null ) l.Add(arg);
                  
            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 3, argExpr_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "argExpr"


    // $ANTLR start "argExpr1"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:219:1: argExpr1 returns [Column result] : argExpr[null] ;
    public Column argExpr1() // throws RecognitionException [1]
    {   
        Column result = default(Column);
        int argExpr1_StartIndex = input.Index();
        SqlResolve.argExpr_return argExpr22 = default(SqlResolve.argExpr_return);


        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 4) ) 
    	    {
    	    	return result; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:220:5: ( argExpr[null] )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:220:7: argExpr[null]
            {
            	PushFollow(FOLLOW_argExpr_in_argExpr1566);
            	argExpr22 = argExpr(null);
            	state.followingStackPointer--;
            	if (state.failed) return result;
            	if ( (state.backtracking==0) )
            	{

            	          result =  ((argExpr22 != null) ? argExpr22.result : default(Column));
            	      
            	}

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 4, argExpr1_StartIndex); 
            }
        }
        return result;
    }
    // $ANTLR end "argExpr1"

    public class pred_return : TreeRuleReturnScope
    {
    };

    // $ANTLR start "pred"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:226:1: pred : ( ^( AND . . ) | ^( OR . . ) | ^( NOT . ) | ^( IS . NULL ) | ^( LIKE . . ) | ^( BETWEEN . . . ) | ^( IN . . ) | ^( EXISTS . ) | ^( ASSIGNEQUAL . . ) | ^( NOTEQUAL1 . . ) | ^( NOTEQUAL2 . . ) | ^( LESSTHANOREQUALTO1 . . ) | ^( LESSTHANOREQUALTO2 . . ) | ^( LESSTHAN . . ) | ^( GREATERTHANOREQUALTO1 . . ) | ^( GREATERTHANOREQUALTO2 . . ) | ^( GREATERTHAN . . ) );
    public SqlResolve.pred_return pred() // throws RecognitionException [1]
    {   
        SqlResolve.pred_return retval = new SqlResolve.pred_return();
        retval.Start = input.LT(1);
        int pred_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 5) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:227:5: ( ^( AND . . ) | ^( OR . . ) | ^( NOT . ) | ^( IS . NULL ) | ^( LIKE . . ) | ^( BETWEEN . . . ) | ^( IN . . ) | ^( EXISTS . ) | ^( ASSIGNEQUAL . . ) | ^( NOTEQUAL1 . . ) | ^( NOTEQUAL2 . . ) | ^( LESSTHANOREQUALTO1 . . ) | ^( LESSTHANOREQUALTO2 . . ) | ^( LESSTHAN . . ) | ^( GREATERTHANOREQUALTO1 . . ) | ^( GREATERTHANOREQUALTO2 . . ) | ^( GREATERTHAN . . ) )
            int alt9 = 17;
            switch ( input.LA(1) ) 
            {
            case AND:
            	{
                alt9 = 1;
                }
                break;
            case OR:
            	{
                alt9 = 2;
                }
                break;
            case NOT:
            	{
                alt9 = 3;
                }
                break;
            case IS:
            	{
                alt9 = 4;
                }
                break;
            case LIKE:
            	{
                alt9 = 5;
                }
                break;
            case BETWEEN:
            	{
                alt9 = 6;
                }
                break;
            case IN:
            	{
                alt9 = 7;
                }
                break;
            case EXISTS:
            	{
                alt9 = 8;
                }
                break;
            case ASSIGNEQUAL:
            	{
                alt9 = 9;
                }
                break;
            case NOTEQUAL1:
            	{
                alt9 = 10;
                }
                break;
            case NOTEQUAL2:
            	{
                alt9 = 11;
                }
                break;
            case LESSTHANOREQUALTO1:
            	{
                alt9 = 12;
                }
                break;
            case LESSTHANOREQUALTO2:
            	{
                alt9 = 13;
                }
                break;
            case LESSTHAN:
            	{
                alt9 = 14;
                }
                break;
            case GREATERTHANOREQUALTO1:
            	{
                alt9 = 15;
                }
                break;
            case GREATERTHANOREQUALTO2:
            	{
                alt9 = 16;
                }
                break;
            case GREATERTHAN:
            	{
                alt9 = 17;
                }
                break;
            	default:
            	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            	    NoViableAltException nvae_d9s0 =
            	        new NoViableAltException("", 9, 0, input);

            	    throw nvae_d9s0;
            }

            switch (alt9) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:227:7: ^( AND . . )
                    {
                    	Match(input,AND,FOLLOW_AND_in_pred591); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:228:7: ^( OR . . )
                    {
                    	Match(input,OR,FOLLOW_OR_in_pred605); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:229:7: ^( NOT . )
                    {
                    	Match(input,NOT,FOLLOW_NOT_in_pred619); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 4 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:230:7: ^( IS . NULL )
                    {
                    	Match(input,IS,FOLLOW_IS_in_pred631); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	Match(input,NULL,FOLLOW_NULL_in_pred635); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 5 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:231:7: ^( LIKE . . )
                    {
                    	Match(input,LIKE,FOLLOW_LIKE_in_pred645); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 6 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:232:7: ^( BETWEEN . . . )
                    {
                    	Match(input,BETWEEN,FOLLOW_BETWEEN_in_pred659); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 7 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:233:7: ^( IN . . )
                    {
                    	Match(input,IN,FOLLOW_IN_in_pred675); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 8 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:234:7: ^( EXISTS . )
                    {
                    	Match(input,EXISTS,FOLLOW_EXISTS_in_pred689); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 9 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:235:7: ^( ASSIGNEQUAL . . )
                    {
                    	Match(input,ASSIGNEQUAL,FOLLOW_ASSIGNEQUAL_in_pred701); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 10 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:236:7: ^( NOTEQUAL1 . . )
                    {
                    	Match(input,NOTEQUAL1,FOLLOW_NOTEQUAL1_in_pred715); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 11 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:237:7: ^( NOTEQUAL2 . . )
                    {
                    	Match(input,NOTEQUAL2,FOLLOW_NOTEQUAL2_in_pred729); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 12 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:238:7: ^( LESSTHANOREQUALTO1 . . )
                    {
                    	Match(input,LESSTHANOREQUALTO1,FOLLOW_LESSTHANOREQUALTO1_in_pred743); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 13 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:239:7: ^( LESSTHANOREQUALTO2 . . )
                    {
                    	Match(input,LESSTHANOREQUALTO2,FOLLOW_LESSTHANOREQUALTO2_in_pred757); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 14 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:240:7: ^( LESSTHAN . . )
                    {
                    	Match(input,LESSTHAN,FOLLOW_LESSTHAN_in_pred771); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 15 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:241:7: ^( GREATERTHANOREQUALTO1 . . )
                    {
                    	Match(input,GREATERTHANOREQUALTO1,FOLLOW_GREATERTHANOREQUALTO1_in_pred785); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 16 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:242:7: ^( GREATERTHANOREQUALTO2 . . )
                    {
                    	Match(input,GREATERTHANOREQUALTO2,FOLLOW_GREATERTHANOREQUALTO2_in_pred799); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;
                case 17 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:243:7: ^( GREATERTHAN . . )
                    {
                    	Match(input,GREATERTHAN,FOLLOW_GREATERTHAN_in_pred813); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;
                    	MatchAny(input); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 5, pred_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "pred"


    // $ANTLR start "varAssign"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:246:1: varAssign : ^( VARASSIGN Variable argExpr1 ) ;
    public void varAssign() // throws RecognitionException [1]
    {   
        int varAssign_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 6) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:247:5: ( ^( VARASSIGN Variable argExpr1 ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:247:7: ^( VARASSIGN Variable argExpr1 )
            {
            	Match(input,VARASSIGN,FOLLOW_VARASSIGN_in_varAssign836); if (state.failed) return ;

            	Match(input, Token.DOWN, null); if (state.failed) return ;
            	Match(input,Variable,FOLLOW_Variable_in_varAssign838); if (state.failed) return ;
            	PushFollow(FOLLOW_argExpr1_in_varAssign840);
            	argExpr1();
            	state.followingStackPointer--;
            	if (state.failed) return ;

            	Match(input, Token.UP, null); if (state.failed) return ;
            	if ( (state.backtracking==0) )
            	{

            	          throw new UnsupportedOperationException();
            	      
            	}

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 6, varAssign_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "varAssign"

    public class functionArg_return : TreeRuleReturnScope
    {
        public IList<Column> result;
        public Column.Function.Modifier modifier;
    };

    // $ANTLR start "functionArg"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:253:1: functionArg returns [IList<Column> result,Column.Function.Modifier modifier] : ( ^( ARG (a= ALL | d= DISTINCT )? STAR ) | ^( ARG (a= ALL | d= DISTINCT )? ( argExpr[args] )+ ) | ^( ARG ( varAssign )+ ) );
    public SqlResolve.functionArg_return functionArg() // throws RecognitionException [1]
    {   
        SqlResolve.functionArg_return retval = new SqlResolve.functionArg_return();
        retval.Start = input.LT(1);
        int functionArg_StartIndex = input.Index();
        CommonTree a = null;
        CommonTree d = null;
        CommonTree STAR23 = null;


                IList<Column> args = new List<Column>();
                Column.Function.Modifier mod = Column.Function.Modifier.NONE;
            
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 7) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:262:5: ( ^( ARG (a= ALL | d= DISTINCT )? STAR ) | ^( ARG (a= ALL | d= DISTINCT )? ( argExpr[args] )+ ) | ^( ARG ( varAssign )+ ) )
            int alt14 = 3;
            int LA14_0 = input.LA(1);

            if ( (LA14_0 == ARG) )
            {
                int LA14_1 = input.LA(2);

                if ( (LA14_1 == DOWN) )
                {
                    switch ( input.LA(3) ) 
                    {
                    case VARASSIGN:
                    	{
                        alt14 = 3;
                        }
                        break;
                    case ALL:
                    	{
                        int LA14_4 = input.LA(4);

                        if ( (LA14_4 == STAR) )
                        {
                            int LA14_6 = input.LA(5);

                            if ( (LA14_6 == UP) )
                            {
                                alt14 = 1;
                            }
                            else if ( (LA14_6 == DOWN) )
                            {
                                alt14 = 2;
                            }
                            else 
                            {
                                if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                                NoViableAltException nvae_d14s6 =
                                    new NoViableAltException("", 14, 6, input);

                                throw nvae_d14s6;
                            }
                        }
                        else if ( (LA14_4 == ARRAY || LA14_4 == CONSTANT || LA14_4 == OBJECT || LA14_4 == QUERY || (LA14_4 >= SIGN_MINUS && LA14_4 <= SIGN_PLUS) || (LA14_4 >= CASE && LA14_4 <= CAST) || (LA14_4 >= CURRENT_TIMESTAMP && LA14_4 <= CURRENT_USER) || LA14_4 == FUNCTION || LA14_4 == SESSION_USER || LA14_4 == SYSTEM_USER || LA14_4 == Variable || (LA14_4 >= PLUS && LA14_4 <= MOD) || LA14_4 == TILDE) )
                        {
                            alt14 = 2;
                        }
                        else 
                        {
                            if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                            NoViableAltException nvae_d14s4 =
                                new NoViableAltException("", 14, 4, input);

                            throw nvae_d14s4;
                        }
                        }
                        break;
                    case DISTINCT:
                    	{
                        int LA14_5 = input.LA(4);

                        if ( (LA14_5 == ARRAY || LA14_5 == CONSTANT || LA14_5 == OBJECT || LA14_5 == QUERY || (LA14_5 >= SIGN_MINUS && LA14_5 <= SIGN_PLUS) || (LA14_5 >= CASE && LA14_5 <= CAST) || (LA14_5 >= CURRENT_TIMESTAMP && LA14_5 <= CURRENT_USER) || LA14_5 == FUNCTION || LA14_5 == SESSION_USER || LA14_5 == SYSTEM_USER || LA14_5 == Variable || (LA14_5 >= PLUS && LA14_5 <= MOD) || LA14_5 == TILDE) )
                        {
                            alt14 = 2;
                        }
                        else if ( (LA14_5 == STAR) )
                        {
                            int LA14_6 = input.LA(5);

                            if ( (LA14_6 == UP) )
                            {
                                alt14 = 1;
                            }
                            else if ( (LA14_6 == DOWN) )
                            {
                                alt14 = 2;
                            }
                            else 
                            {
                                if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                                NoViableAltException nvae_d14s6 =
                                    new NoViableAltException("", 14, 6, input);

                                throw nvae_d14s6;
                            }
                        }
                        else 
                        {
                            if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                            NoViableAltException nvae_d14s5 =
                                new NoViableAltException("", 14, 5, input);

                            throw nvae_d14s5;
                        }
                        }
                        break;
                    case STAR:
                    	{
                        int LA14_6 = input.LA(4);

                        if ( (LA14_6 == UP) )
                        {
                            alt14 = 1;
                        }
                        else if ( (LA14_6 == DOWN) )
                        {
                            alt14 = 2;
                        }
                        else 
                        {
                            if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                            NoViableAltException nvae_d14s6 =
                                new NoViableAltException("", 14, 6, input);

                            throw nvae_d14s6;
                        }
                        }
                        break;
                    case ARRAY:
                    case CONSTANT:
                    case OBJECT:
                    case QUERY:
                    case SIGN_MINUS:
                    case SIGN_PLUS:
                    case CASE:
                    case CAST:
                    case CURRENT_TIMESTAMP:
                    case CURRENT_USER:
                    case FUNCTION:
                    case SESSION_USER:
                    case SYSTEM_USER:
                    case Variable:
                    case PLUS:
                    case MINUS:
                    case AMPERSAND:
                    case BITWISEOR:
                    case BITWISEXOR:
                    case DIVIDE:
                    case MOD:
                    case TILDE:
                    	{
                        alt14 = 2;
                        }
                        break;
                    	default:
                    	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    	    NoViableAltException nvae_d14s2 =
                    	        new NoViableAltException("", 14, 2, input);

                    	    throw nvae_d14s2;
                    }

                }
                else 
                {
                    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    NoViableAltException nvae_d14s1 =
                        new NoViableAltException("", 14, 1, input);

                    throw nvae_d14s1;
                }
            }
            else 
            {
                if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                NoViableAltException nvae_d14s0 =
                    new NoViableAltException("", 14, 0, input);

                throw nvae_d14s0;
            }
            switch (alt14) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:262:7: ^( ARG (a= ALL | d= DISTINCT )? STAR )
                    {
                    	Match(input,ARG,FOLLOW_ARG_in_functionArg887); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:262:13: (a= ALL | d= DISTINCT )?
                    	int alt10 = 3;
                    	int LA10_0 = input.LA(1);

                    	if ( (LA10_0 == ALL) )
                    	{
                    	    alt10 = 1;
                    	}
                    	else if ( (LA10_0 == DISTINCT) )
                    	{
                    	    alt10 = 2;
                    	}
                    	switch (alt10) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:262:14: a= ALL
                    	        {
                    	        	a=(CommonTree)Match(input,ALL,FOLLOW_ALL_in_functionArg892); if (state.failed) return retval;

                    	        }
                    	        break;
                    	    case 2 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:262:20: d= DISTINCT
                    	        {
                    	        	d=(CommonTree)Match(input,DISTINCT,FOLLOW_DISTINCT_in_functionArg896); if (state.failed) return retval;

                    	        }
                    	        break;

                    	}

                    	STAR23=(CommonTree)Match(input,STAR,FOLLOW_STAR_in_functionArg900); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          if ( a != null )
                    	              mod = Column.Function.Modifier.ALL;
                    	          else if ( d != null )
                    	              mod = Column.Function.Modifier.DISTINCT;

                    	          args.Add(new Column.Star(current,STAR23));
                    	      
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:271:7: ^( ARG (a= ALL | d= DISTINCT )? ( argExpr[args] )+ )
                    {
                    	Match(input,ARG,FOLLOW_ARG_in_functionArg916); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:271:13: (a= ALL | d= DISTINCT )?
                    	int alt11 = 3;
                    	int LA11_0 = input.LA(1);

                    	if ( (LA11_0 == ALL) )
                    	{
                    	    alt11 = 1;
                    	}
                    	else if ( (LA11_0 == DISTINCT) )
                    	{
                    	    alt11 = 2;
                    	}
                    	switch (alt11) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:271:14: a= ALL
                    	        {
                    	        	a=(CommonTree)Match(input,ALL,FOLLOW_ALL_in_functionArg921); if (state.failed) return retval;

                    	        }
                    	        break;
                    	    case 2 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:271:20: d= DISTINCT
                    	        {
                    	        	d=(CommonTree)Match(input,DISTINCT,FOLLOW_DISTINCT_in_functionArg925); if (state.failed) return retval;

                    	        }
                    	        break;

                    	}

                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:271:33: ( argExpr[args] )+
                    	int cnt12 = 0;
                    	do 
                    	{
                    	    int alt12 = 2;
                    	    int LA12_0 = input.LA(1);

                    	    if ( (LA12_0 == ARRAY || LA12_0 == CONSTANT || LA12_0 == OBJECT || LA12_0 == QUERY || (LA12_0 >= SIGN_MINUS && LA12_0 <= SIGN_PLUS) || (LA12_0 >= CASE && LA12_0 <= CAST) || (LA12_0 >= CURRENT_TIMESTAMP && LA12_0 <= CURRENT_USER) || LA12_0 == FUNCTION || LA12_0 == SESSION_USER || LA12_0 == SYSTEM_USER || (LA12_0 >= STAR && LA12_0 <= Variable) || (LA12_0 >= PLUS && LA12_0 <= MOD) || LA12_0 == TILDE) )
                    	    {
                    	        alt12 = 1;
                    	    }


                    	    switch (alt12) 
                    		{
                    			case 1 :
                    			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: argExpr[args]
                    			    {
                    			    	PushFollow(FOLLOW_argExpr_in_functionArg929);
                    			    	argExpr(args);
                    			    	state.followingStackPointer--;
                    			    	if (state.failed) return retval;

                    			    }
                    			    break;

                    			default:
                    			    if ( cnt12 >= 1 ) goto loop12;
                    			    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    		            EarlyExitException eee12 =
                    		                new EarlyExitException(12, input);
                    		            throw eee12;
                    	    }
                    	    cnt12++;
                    	} while (true);

                    	loop12:
                    		;	// Stops C# compiler whining that label 'loop12' has no statements


                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          if ( a != null )
                    	              mod = Column.Function.Modifier.ALL;
                    	          else if ( d != null )
                    	              mod = Column.Function.Modifier.DISTINCT;
                    	      
                    	}

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:278:7: ^( ARG ( varAssign )+ )
                    {
                    	Match(input,ARG,FOLLOW_ARG_in_functionArg947); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:278:13: ( varAssign )+
                    	int cnt13 = 0;
                    	do 
                    	{
                    	    int alt13 = 2;
                    	    int LA13_0 = input.LA(1);

                    	    if ( (LA13_0 == VARASSIGN) )
                    	    {
                    	        alt13 = 1;
                    	    }


                    	    switch (alt13) 
                    		{
                    			case 1 :
                    			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: varAssign
                    			    {
                    			    	PushFollow(FOLLOW_varAssign_in_functionArg949);
                    			    	varAssign();
                    			    	state.followingStackPointer--;
                    			    	if (state.failed) return retval;

                    			    }
                    			    break;

                    			default:
                    			    if ( cnt13 >= 1 ) goto loop13;
                    			    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    		            EarlyExitException eee13 =
                    		                new EarlyExitException(13, input);
                    		            throw eee13;
                    	    }
                    	    cnt13++;
                    	} while (true);

                    	loop13:
                    		;	// Stops C# compiler whining that label 'loop13' has no statements


                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          throw new UnsupportedOperationException();
                    	      
                    	}

                    }
                    break;

            }
            if ( (state.backtracking==0) )
            {

                      retval.result =  args;
                      retval.modifier =  mod;
                  
            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 7, functionArg_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "functionArg"

    public class function_return : TreeRuleReturnScope
    {
        public Column.Function result;
    };

    // $ANTLR start "function"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:284:1: function returns [Column.Function result] : ( ^( FUNCTION ( LEFT | RIGHT | identifier ) functionArg ) | ^( FUNCTION identifier NOARG ) );
    public SqlResolve.function_return function() // throws RecognitionException [1]
    {   
        SqlResolve.function_return retval = new SqlResolve.function_return();
        retval.Start = input.LT(1);
        int function_StartIndex = input.Index();
        CommonTree LEFT24 = null;
        CommonTree RIGHT25 = null;
        SqlResolve.identifier_return identifier26 = default(SqlResolve.identifier_return);

        SqlResolve.functionArg_return functionArg27 = default(SqlResolve.functionArg_return);

        SqlResolve.identifier_return identifier28 = default(SqlResolve.identifier_return);



                Column.Function func = null;
            
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 8) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:292:5: ( ^( FUNCTION ( LEFT | RIGHT | identifier ) functionArg ) | ^( FUNCTION identifier NOARG ) )
            int alt16 = 2;
            int LA16_0 = input.LA(1);

            if ( (LA16_0 == FUNCTION) )
            {
                int LA16_1 = input.LA(2);

                if ( (LA16_1 == DOWN) )
                {
                    switch ( input.LA(3) ) 
                    {
                    case LEFT:
                    case RIGHT:
                    	{
                        alt16 = 1;
                        }
                        break;
                    case NonQuotedIdentifier:
                    	{
                        int LA16_4 = input.LA(4);

                        if ( (LA16_4 == ARG) )
                        {
                            alt16 = 1;
                        }
                        else if ( (LA16_4 == NOARG) )
                        {
                            alt16 = 2;
                        }
                        else 
                        {
                            if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                            NoViableAltException nvae_d16s4 =
                                new NoViableAltException("", 16, 4, input);

                            throw nvae_d16s4;
                        }
                        }
                        break;
                    case QuotedIdentifier:
                    	{
                        int LA16_5 = input.LA(4);

                        if ( (LA16_5 == NOARG) )
                        {
                            alt16 = 2;
                        }
                        else if ( (LA16_5 == ARG) )
                        {
                            alt16 = 1;
                        }
                        else 
                        {
                            if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                            NoViableAltException nvae_d16s5 =
                                new NoViableAltException("", 16, 5, input);

                            throw nvae_d16s5;
                        }
                        }
                        break;
                    	default:
                    	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    	    NoViableAltException nvae_d16s2 =
                    	        new NoViableAltException("", 16, 2, input);

                    	    throw nvae_d16s2;
                    }

                }
                else 
                {
                    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    NoViableAltException nvae_d16s1 =
                        new NoViableAltException("", 16, 1, input);

                    throw nvae_d16s1;
                }
            }
            else 
            {
                if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                NoViableAltException nvae_d16s0 =
                    new NoViableAltException("", 16, 0, input);

                throw nvae_d16s0;
            }
            switch (alt16) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:292:7: ^( FUNCTION ( LEFT | RIGHT | identifier ) functionArg )
                    {
                    	Match(input,FUNCTION,FOLLOW_FUNCTION_in_function997); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:292:18: ( LEFT | RIGHT | identifier )
                    	int alt15 = 3;
                    	switch ( input.LA(1) ) 
                    	{
                    	case LEFT:
                    		{
                    	    alt15 = 1;
                    	    }
                    	    break;
                    	case RIGHT:
                    		{
                    	    alt15 = 2;
                    	    }
                    	    break;
                    	case NonQuotedIdentifier:
                    	case QuotedIdentifier:
                    		{
                    	    alt15 = 3;
                    	    }
                    	    break;
                    		default:
                    		    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                    		    NoViableAltException nvae_d15s0 =
                    		        new NoViableAltException("", 15, 0, input);

                    		    throw nvae_d15s0;
                    	}

                    	switch (alt15) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:292:19: LEFT
                    	        {
                    	        	LEFT24=(CommonTree)Match(input,LEFT,FOLLOW_LEFT_in_function1000); if (state.failed) return retval;

                    	        }
                    	        break;
                    	    case 2 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:292:24: RIGHT
                    	        {
                    	        	RIGHT25=(CommonTree)Match(input,RIGHT,FOLLOW_RIGHT_in_function1002); if (state.failed) return retval;

                    	        }
                    	        break;
                    	    case 3 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:292:30: identifier
                    	        {
                    	        	PushFollow(FOLLOW_identifier_in_function1004);
                    	        	identifier26 = identifier();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return retval;

                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_functionArg_in_function1007);
                    	functionArg27 = functionArg();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          String fn;
                    	          if ( LEFT24 != null ) { fn = "left"; }
                    	          else if ( RIGHT25 != null ) { fn = "right"; }
                    	          else fn = ((identifier26 != null) ? identifier26.result : default(String));

                    	          func = new Column.Function(current,fn,
                    	              ((functionArg27 != null) ? functionArg27.modifier : default(Column.Function.Modifier)),((functionArg27 != null) ? functionArg27.result : default(IList<Column>)));

                    	          if ( Column.isAggregate(fn) ) {
                    	              if ( func.size() != 1 ) {
                    	                  throw new UnsupportedOperationException();
                    	              }
                    	          }
                    	      
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:308:7: ^( FUNCTION identifier NOARG )
                    {
                    	Match(input,FUNCTION,FOLLOW_FUNCTION_in_function1023); if (state.failed) return retval;

                    	Match(input, Token.DOWN, null); if (state.failed) return retval;
                    	PushFollow(FOLLOW_identifier_in_function1025);
                    	identifier28 = identifier();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	Match(input,NOARG,FOLLOW_NOARG_in_function1027); if (state.failed) return retval;

                    	Match(input, Token.UP, null); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          String fn = ((identifier28 != null) ? identifier28.result : default(String));

                    	          if ( Column.isAggregate(fn) ) {
                    	              throw new UnsupportedOperationException();
                    	          }

                    	          IList<Column> noParam = new List<Column>().AsReadOnly();

                    	          func = new Column.Function(current,fn,Column.Function.Modifier.NONE,noParam);
                    	      
                    	}

                    }
                    break;

            }
            if ( (state.backtracking==0) )
            {

                      func.setExpression(((CommonTree)retval.Start));
                      retval.result =  func;
                  
            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 8, function_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "function"


    // $ANTLR start "alias1"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:326:1: alias1 returns [String result] : ( ^( ALIAS identifier ) | ^( ALIAS stringLiteral ) | ^( ALIAS keywordAsIdentifier ) );
    public String alias1() // throws RecognitionException [1]
    {   
        String result = default(String);
        int alias1_StartIndex = input.Index();
        SqlResolve.identifier_return identifier29 = default(SqlResolve.identifier_return);

        SqlResolve.stringLiteral_return stringLiteral30 = default(SqlResolve.stringLiteral_return);

        SqlResolve.keywordAsIdentifier_return keywordAsIdentifier31 = default(SqlResolve.keywordAsIdentifier_return);


        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 9) ) 
    	    {
    	    	return result; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:327:5: ( ^( ALIAS identifier ) | ^( ALIAS stringLiteral ) | ^( ALIAS keywordAsIdentifier ) )
            int alt17 = 3;
            int LA17_0 = input.LA(1);

            if ( (LA17_0 == ALIAS) )
            {
                int LA17_1 = input.LA(2);

                if ( (LA17_1 == DOWN) )
                {
                    switch ( input.LA(3) ) 
                    {
                    case AUTO:
                    case BASE64:
                    case BINARY:
                    case CAST:
                    case CONCAT:
                    case CUBE:
                    case ELEMENTS:
                    case EXPAND:
                    case EXPLICIT:
                    case FAST:
                    case FASTFIRSTROW:
                    case FORCE:
                    case HASH:
                    case KEEP:
                    case KEEPFIXED:
                    case LOOP:
                    case MAXDOP:
                    case MERGE:
                    case NOLOCK:
                    case PAGLOCK:
                    case RAW:
                    case READCOMMITED:
                    case READPAST:
                    case READUNCOMMITED:
                    case REMOTE:
                    case REPEATABLEREAD:
                    case ROBUST:
                    case ROLLUP:
                    case ROWLOCK:
                    case SERIALIZABLE:
                    case TABLOCK:
                    case TABLOCKX:
                    case TIES:
                    case UPDLOCK:
                    case VIEWS:
                    case XLOCK:
                    case XML:
                    case XMLDATA:
                    	{
                        alt17 = 3;
                        }
                        break;
                    case UnicodeStringLiteral:
                    case ASCIIStringLiteral:
                    	{
                        alt17 = 2;
                        }
                        break;
                    case NonQuotedIdentifier:
                    case QuotedIdentifier:
                    	{
                        alt17 = 1;
                        }
                        break;
                    	default:
                    	    if ( state.backtracking > 0 ) {state.failed = true; return result;}
                    	    NoViableAltException nvae_d17s2 =
                    	        new NoViableAltException("", 17, 2, input);

                    	    throw nvae_d17s2;
                    }

                }
                else 
                {
                    if ( state.backtracking > 0 ) {state.failed = true; return result;}
                    NoViableAltException nvae_d17s1 =
                        new NoViableAltException("", 17, 1, input);

                    throw nvae_d17s1;
                }
            }
            else 
            {
                if ( state.backtracking > 0 ) {state.failed = true; return result;}
                NoViableAltException nvae_d17s0 =
                    new NoViableAltException("", 17, 0, input);

                throw nvae_d17s0;
            }
            switch (alt17) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:327:7: ^( ALIAS identifier )
                    {
                    	Match(input,ALIAS,FOLLOW_ALIAS_in_alias11059); if (state.failed) return result;

                    	Match(input, Token.DOWN, null); if (state.failed) return result;
                    	PushFollow(FOLLOW_identifier_in_alias11061);
                    	identifier29 = identifier();
                    	state.followingStackPointer--;
                    	if (state.failed) return result;

                    	Match(input, Token.UP, null); if (state.failed) return result;
                    	if ( (state.backtracking==0) )
                    	{
                    	   result =  ((identifier29 != null) ? identifier29.result : default(String)); 
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:329:7: ^( ALIAS stringLiteral )
                    {
                    	Match(input,ALIAS,FOLLOW_ALIAS_in_alias11078); if (state.failed) return result;

                    	Match(input, Token.DOWN, null); if (state.failed) return result;
                    	PushFollow(FOLLOW_stringLiteral_in_alias11080);
                    	stringLiteral30 = stringLiteral();
                    	state.followingStackPointer--;
                    	if (state.failed) return result;

                    	Match(input, Token.UP, null); if (state.failed) return result;
                    	if ( (state.backtracking==0) )
                    	{
                    	   result =  ((stringLiteral30 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(stringLiteral30.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(stringLiteral30.Start)) : null); 
                    	}

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:331:7: ^( ALIAS keywordAsIdentifier )
                    {
                    	Match(input,ALIAS,FOLLOW_ALIAS_in_alias11096); if (state.failed) return result;

                    	Match(input, Token.DOWN, null); if (state.failed) return result;
                    	PushFollow(FOLLOW_keywordAsIdentifier_in_alias11098);
                    	keywordAsIdentifier31 = keywordAsIdentifier();
                    	state.followingStackPointer--;
                    	if (state.failed) return result;

                    	Match(input, Token.UP, null); if (state.failed) return result;
                    	if ( (state.backtracking==0) )
                    	{
                    	   result =  ((keywordAsIdentifier31 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(keywordAsIdentifier31.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(keywordAsIdentifier31.Start)) : null); 
                    	}

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 9, alias1_StartIndex); 
            }
        }
        return result;
    }
    // $ANTLR end "alias1"


    // $ANTLR start "topKclause"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:339:1: topKclause : ^( TOP . ( PERCENT )? ( TIES )? ) ;
    public void topKclause() // throws RecognitionException [1]
    {   
        int topKclause_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 10) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:340:5: ( ^( TOP . ( PERCENT )? ( TIES )? ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:340:7: ^( TOP . ( PERCENT )? ( TIES )? )
            {
            	Match(input,TOP,FOLLOW_TOP_in_topKclause1126); if (state.failed) return ;

            	Match(input, Token.DOWN, null); if (state.failed) return ;
            	MatchAny(input); if (state.failed) return ;
            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:340:15: ( PERCENT )?
            	int alt18 = 2;
            	int LA18_0 = input.LA(1);

            	if ( (LA18_0 == PERCENT) )
            	{
            	    alt18 = 1;
            	}
            	switch (alt18) 
            	{
            	    case 1 :
            	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: PERCENT
            	        {
            	        	Match(input,PERCENT,FOLLOW_PERCENT_in_topKclause1130); if (state.failed) return ;

            	        }
            	        break;

            	}

            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:340:24: ( TIES )?
            	int alt19 = 2;
            	int LA19_0 = input.LA(1);

            	if ( (LA19_0 == TIES) )
            	{
            	    alt19 = 1;
            	}
            	switch (alt19) 
            	{
            	    case 1 :
            	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: TIES
            	        {
            	        	Match(input,TIES,FOLLOW_TIES_in_topKclause1133); if (state.failed) return ;

            	        }
            	        break;

            	}


            	Match(input, Token.UP, null); if (state.failed) return ;

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 10, topKclause_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "topKclause"

    public class tableColumns_return : TreeRuleReturnScope
    {
        public IView result;
    };

    // $ANTLR start "tableColumns"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:343:1: tableColumns returns [IView result] : ^( TABLECOLS dbObject ) ;
    public SqlResolve.tableColumns_return tableColumns() // throws RecognitionException [1]
    {   
        SqlResolve.tableColumns_return retval = new SqlResolve.tableColumns_return();
        retval.Start = input.LT(1);
        int tableColumns_StartIndex = input.Index();
        SqlResolve.dbObject_return dbObject32 = default(SqlResolve.dbObject_return);


        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 11) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:344:5: ( ^( TABLECOLS dbObject ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:344:7: ^( TABLECOLS dbObject )
            {
            	Match(input,TABLECOLS,FOLLOW_TABLECOLS_in_tableColumns1157); if (state.failed) return retval;

            	Match(input, Token.DOWN, null); if (state.failed) return retval;
            	PushFollow(FOLLOW_dbObject_in_tableColumns1159);
            	dbObject32 = dbObject();
            	state.followingStackPointer--;
            	if (state.failed) return retval;

            	Match(input, Token.UP, null); if (state.failed) return retval;
            	if ( (state.backtracking==0) )
            	{

            	          // FIXME: project all columns from given relation
            	          String[] x = (String[])((dbObject32 != null) ? dbObject32.obj : default(String[]));
            	          String relName = x[x.Length - 1];
            	          IView v = resolver.resolve(relName);
            	          foreach ( Column c in v.getColumns(true) ) {
            	              current.add(new Column.Value(current,((dbObject32 != null) ? ((CommonTree)dbObject32.Start) : null),c));
            	          }

            	          retval.result =  v;
            	      
            	}

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 11, tableColumns_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "tableColumns"


    // $ANTLR start "selectItem"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:358:1: selectItem : ( STAR | ^( SELECTITEM tableColumns ) | ^( SELECTITEM dbObject (a= alias1 )? ) | ^( SELECTITEM subQuery (a= alias1 )? ) | ^( SELECTITEM function (a= alias1 )? ) | ^( SELECTITEM argExpr[null] (a= alias1 )? ) );
    public void selectItem() // throws RecognitionException [1]
    {   
        int selectItem_StartIndex = input.Index();
        CommonTree STAR33 = null;
        String a = default(String);

        SqlResolve.tableColumns_return tableColumns34 = default(SqlResolve.tableColumns_return);

        SqlResolve.dbObject_return dbObject35 = default(SqlResolve.dbObject_return);

        SqlResolve.subQuery_return subQuery36 = default(SqlResolve.subQuery_return);

        SqlResolve.function_return function37 = default(SqlResolve.function_return);

        SqlResolve.argExpr_return argExpr38 = default(SqlResolve.argExpr_return);


        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 12) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:359:5: ( STAR | ^( SELECTITEM tableColumns ) | ^( SELECTITEM dbObject (a= alias1 )? ) | ^( SELECTITEM subQuery (a= alias1 )? ) | ^( SELECTITEM function (a= alias1 )? ) | ^( SELECTITEM argExpr[null] (a= alias1 )? ) )
            int alt24 = 6;
            int LA24_0 = input.LA(1);

            if ( (LA24_0 == STAR) )
            {
                alt24 = 1;
            }
            else if ( (LA24_0 == SELECTITEM) )
            {
                int LA24_2 = input.LA(2);

                if ( (synpred59_SqlResolve()) )
                {
                    alt24 = 2;
                }
                else if ( (synpred61_SqlResolve()) )
                {
                    alt24 = 3;
                }
                else if ( (synpred63_SqlResolve()) )
                {
                    alt24 = 4;
                }
                else if ( (synpred65_SqlResolve()) )
                {
                    alt24 = 5;
                }
                else if ( (true) )
                {
                    alt24 = 6;
                }
                else 
                {
                    if ( state.backtracking > 0 ) {state.failed = true; return ;}
                    NoViableAltException nvae_d24s2 =
                        new NoViableAltException("", 24, 2, input);

                    throw nvae_d24s2;
                }
            }
            else 
            {
                if ( state.backtracking > 0 ) {state.failed = true; return ;}
                NoViableAltException nvae_d24s0 =
                    new NoViableAltException("", 24, 0, input);

                throw nvae_d24s0;
            }
            switch (alt24) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:359:7: STAR
                    {
                    	STAR33=(CommonTree)Match(input,STAR,FOLLOW_STAR_in_selectItem1184); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          current.star();
                    	          colIndex[STAR33] = new Column.Star(current,STAR33) ;
                    	      
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:364:7: ^( SELECTITEM tableColumns )
                    {
                    	Match(input,SELECTITEM,FOLLOW_SELECTITEM_in_selectItem1199); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_tableColumns_in_selectItem1201);
                    	tableColumns34 = tableColumns();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          colIndex[ ((tableColumns34 != null) ? ((CommonTree)tableColumns34.Start) : null) ] = new Column.Star(current,((tableColumns34 != null) ? ((CommonTree)tableColumns34.Start) : null),((tableColumns34 != null) ? tableColumns34.result : default(IView)) ) ;

                    	      
                    	}

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:369:7: ^( SELECTITEM dbObject (a= alias1 )? )
                    {
                    	Match(input,SELECTITEM,FOLLOW_SELECTITEM_in_selectItem1217); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_dbObject_in_selectItem1219);
                    	dbObject35 = dbObject();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:369:29: (a= alias1 )?
                    	int alt20 = 2;
                    	int LA20_0 = input.LA(1);

                    	if ( (LA20_0 == ALIAS) )
                    	{
                    	    alt20 = 1;
                    	}
                    	switch (alt20) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:369:30: a= alias1
                    	        {
                    	        	PushFollow(FOLLOW_alias1_in_selectItem1224);
                    	        	a = alias1();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          String t = ( a == null ) ? null : a;
                    	          String[] x = (String[])((dbObject35 != null) ? dbObject35.obj : default(String[]));
                    	          String relName = ( x.Length > 1 ) ? x[x.Length - 2] : null;
                    	          String colName = x[x.Length - 1];

                    	          Column c = resolver.resolve(relName,colName);

                    	          Debug.Assert( c != null );

                    	          Column nc = new Column.Value(current,((dbObject35 != null) ? ((CommonTree)dbObject35.Start) : null),c,t);
                    	          current.add(nc);

                    	          colIndex[ ((dbObject35 != null) ? ((CommonTree)dbObject35.Start) : null) ] = nc ;
                    	      
                    	}

                    }
                    break;
                case 4 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:385:7: ^( SELECTITEM subQuery (a= alias1 )? )
                    {
                    	Match(input,SELECTITEM,FOLLOW_SELECTITEM_in_selectItem1242); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_subQuery_in_selectItem1244);
                    	subQuery36 = subQuery();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:385:29: (a= alias1 )?
                    	int alt21 = 2;
                    	int LA21_0 = input.LA(1);

                    	if ( (LA21_0 == ALIAS) )
                    	{
                    	    alt21 = 1;
                    	}
                    	switch (alt21) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:385:30: a= alias1
                    	        {
                    	        	PushFollow(FOLLOW_alias1_in_selectItem1249);
                    	        	a = alias1();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          String t = a;

                    	          // find r in given from result
                    	          SqlQuery q = current.getSubQuery(((subQuery36 != null) ? ((CommonTree)subQuery36.Start) : null));

                    	          if ( q == null )
                    	              throw new UnknownTableException("Unknown subquery: "+((subQuery36 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(subQuery36.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(subQuery36.Start)) : null));

                    	          Debug.Assert( q.getCardinality() == 1 );

                    	          Column.Query c = new Column.Query(current,q,t);
                    	          //Column c = new Column(current,q.getFirstColumn(),t);
                    	          //c.setExpression(((subQuery36 != null) ? ((CommonTree)subQuery36.Start) : null));

                    	          current.add(c);

                    	          colIndex[ ((subQuery36 != null) ? ((CommonTree)subQuery36.Start) : null) ] =  c ;
                    	          viewIndex[ ((subQuery36 != null) ? ((CommonTree)subQuery36.Start) : null) ] = q ;
                    	      
                    	}

                    }
                    break;
                case 5 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:406:7: ^( SELECTITEM function (a= alias1 )? )
                    {
                    	Match(input,SELECTITEM,FOLLOW_SELECTITEM_in_selectItem1267); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_function_in_selectItem1269);
                    	function37 = function();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:406:29: (a= alias1 )?
                    	int alt22 = 2;
                    	int LA22_0 = input.LA(1);

                    	if ( (LA22_0 == ALIAS) )
                    	{
                    	    alt22 = 1;
                    	}
                    	switch (alt22) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:406:30: a= alias1
                    	        {
                    	        	PushFollow(FOLLOW_alias1_in_selectItem1274);
                    	        	a = alias1();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          String t = a;
                    	          ((function37 != null) ? function37.result : default(Column.Function)).setAlias(t);
                    	          current.add(((function37 != null) ? function37.result : default(Column.Function)));

                    	          colIndex[ ((function37 != null) ? ((CommonTree)function37.Start) : null) ] = ((function37 != null) ? function37.result : default(Column.Function)) ;
                    	      
                    	}

                    }
                    break;
                case 6 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:414:7: ^( SELECTITEM argExpr[null] (a= alias1 )? )
                    {
                    	Match(input,SELECTITEM,FOLLOW_SELECTITEM_in_selectItem1292); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_argExpr_in_selectItem1294);
                    	argExpr38 = argExpr(null);
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:414:34: (a= alias1 )?
                    	int alt23 = 2;
                    	int LA23_0 = input.LA(1);

                    	if ( (LA23_0 == ALIAS) )
                    	{
                    	    alt23 = 1;
                    	}
                    	switch (alt23) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:414:35: a= alias1
                    	        {
                    	        	PushFollow(FOLLOW_alias1_in_selectItem1300);
                    	        	a = alias1();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{


                    	          String t = a;
                    	          ((argExpr38 != null) ? argExpr38.result : default(Column)).setAlias(t);


                    	          current.add(((argExpr38 != null) ? argExpr38.result : default(Column)));

                    	          colIndex[ ((argExpr38 != null) ? ((CommonTree)argExpr38.Start) : null) ] = ((argExpr38 != null) ? argExpr38.result : default(Column)) ;
                    	      
                    	}

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 12, selectItem_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "selectItem"


    // $ANTLR start "selectClause"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:427:1: selectClause : ^( SELECT ( ALL | DISTINCT )? ( topKclause )? ( selectItem )+ ) ;
    public void selectClause() // throws RecognitionException [1]
    {   
        int selectClause_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 13) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:428:5: ( ^( SELECT ( ALL | DISTINCT )? ( topKclause )? ( selectItem )+ ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:428:7: ^( SELECT ( ALL | DISTINCT )? ( topKclause )? ( selectItem )+ )
            {
            	Match(input,SELECT,FOLLOW_SELECT_in_selectClause1327); if (state.failed) return ;

            	Match(input, Token.DOWN, null); if (state.failed) return ;
            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:428:16: ( ALL | DISTINCT )?
            	int alt25 = 2;
            	int LA25_0 = input.LA(1);

            	if ( (LA25_0 == ALL || LA25_0 == DISTINCT) )
            	{
            	    alt25 = 1;
            	}
            	switch (alt25) 
            	{
            	    case 1 :
            	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:
            	        {
            	        	if ( input.LA(1) == ALL || input.LA(1) == DISTINCT ) 
            	        	{
            	        	    input.Consume();
            	        	    state.errorRecovery = false;state.failed = false;
            	        	}
            	        	else 
            	        	{
            	        	    if ( state.backtracking > 0 ) {state.failed = true; return ;}
            	        	    MismatchedSetException mse = new MismatchedSetException(null,input);
            	        	    throw mse;
            	        	}


            	        }
            	        break;

            	}

            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:428:32: ( topKclause )?
            	int alt26 = 2;
            	int LA26_0 = input.LA(1);

            	if ( (LA26_0 == TOP) )
            	{
            	    alt26 = 1;
            	}
            	switch (alt26) 
            	{
            	    case 1 :
            	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: topKclause
            	        {
            	        	PushFollow(FOLLOW_topKclause_in_selectClause1336);
            	        	topKclause();
            	        	state.followingStackPointer--;
            	        	if (state.failed) return ;

            	        }
            	        break;

            	}

            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:428:44: ( selectItem )+
            	int cnt27 = 0;
            	do 
            	{
            	    int alt27 = 2;
            	    int LA27_0 = input.LA(1);

            	    if ( (LA27_0 == SELECTITEM || LA27_0 == STAR) )
            	    {
            	        alt27 = 1;
            	    }


            	    switch (alt27) 
            		{
            			case 1 :
            			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: selectItem
            			    {
            			    	PushFollow(FOLLOW_selectItem_in_selectClause1339);
            			    	selectItem();
            			    	state.followingStackPointer--;
            			    	if (state.failed) return ;

            			    }
            			    break;

            			default:
            			    if ( cnt27 >= 1 ) goto loop27;
            			    if ( state.backtracking > 0 ) {state.failed = true; return ;}
            		            EarlyExitException eee27 =
            		                new EarlyExitException(27, input);
            		            throw eee27;
            	    }
            	    cnt27++;
            	} while (true);

            	loop27:
            		;	// Stops C# compiler whining that label 'loop27' has no statements


            	Match(input, Token.UP, null); if (state.failed) return ;

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 13, selectClause_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "selectClause"


    // $ANTLR start "joinType"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:435:1: joinType : ( ^( TYPE CROSS ) | ^( TYPE INNER ) | ^( TYPE ( LEFT | RIGHT | FULL ) ( OUTER )? ) );
    public void joinType() // throws RecognitionException [1]
    {   
        int joinType_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 14) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:436:5: ( ^( TYPE CROSS ) | ^( TYPE INNER ) | ^( TYPE ( LEFT | RIGHT | FULL ) ( OUTER )? ) )
            int alt29 = 3;
            int LA29_0 = input.LA(1);

            if ( (LA29_0 == TYPE) )
            {
                int LA29_1 = input.LA(2);

                if ( (LA29_1 == DOWN) )
                {
                    switch ( input.LA(3) ) 
                    {
                    case CROSS:
                    	{
                        alt29 = 1;
                        }
                        break;
                    case INNER:
                    	{
                        alt29 = 2;
                        }
                        break;
                    case FULL:
                    case LEFT:
                    case RIGHT:
                    	{
                        alt29 = 3;
                        }
                        break;
                    	default:
                    	    if ( state.backtracking > 0 ) {state.failed = true; return ;}
                    	    NoViableAltException nvae_d29s2 =
                    	        new NoViableAltException("", 29, 2, input);

                    	    throw nvae_d29s2;
                    }

                }
                else 
                {
                    if ( state.backtracking > 0 ) {state.failed = true; return ;}
                    NoViableAltException nvae_d29s1 =
                        new NoViableAltException("", 29, 1, input);

                    throw nvae_d29s1;
                }
            }
            else 
            {
                if ( state.backtracking > 0 ) {state.failed = true; return ;}
                NoViableAltException nvae_d29s0 =
                    new NoViableAltException("", 29, 0, input);

                throw nvae_d29s0;
            }
            switch (alt29) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:436:7: ^( TYPE CROSS )
                    {
                    	Match(input,TYPE,FOLLOW_TYPE_in_joinType1362); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	Match(input,CROSS,FOLLOW_CROSS_in_joinType1364); if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:437:7: ^( TYPE INNER )
                    {
                    	Match(input,TYPE,FOLLOW_TYPE_in_joinType1374); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	Match(input,INNER,FOLLOW_INNER_in_joinType1376); if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:438:7: ^( TYPE ( LEFT | RIGHT | FULL ) ( OUTER )? )
                    {
                    	Match(input,TYPE,FOLLOW_TYPE_in_joinType1386); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	if ( input.LA(1) == FULL || input.LA(1) == LEFT || input.LA(1) == RIGHT ) 
                    	{
                    	    input.Consume();
                    	    state.errorRecovery = false;state.failed = false;
                    	}
                    	else 
                    	{
                    	    if ( state.backtracking > 0 ) {state.failed = true; return ;}
                    	    MismatchedSetException mse = new MismatchedSetException(null,input);
                    	    throw mse;
                    	}

                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:438:32: ( OUTER )?
                    	int alt28 = 2;
                    	int LA28_0 = input.LA(1);

                    	if ( (LA28_0 == OUTER) )
                    	{
                    	    alt28 = 1;
                    	}
                    	switch (alt28) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: OUTER
                    	        {
                    	        	Match(input,OUTER,FOLLOW_OUTER_in_joinType1396); if (state.failed) return ;

                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 14, joinType_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "joinType"


    // $ANTLR start "joinHint"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:441:1: joinHint : ^( HINT . ) ;
    public void joinHint() // throws RecognitionException [1]
    {   
        int joinHint_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 15) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:442:5: ( ^( HINT . ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:442:7: ^( HINT . )
            {
            	Match(input,HINT,FOLLOW_HINT_in_joinHint1416); if (state.failed) return ;

            	Match(input, Token.DOWN, null); if (state.failed) return ;
            	MatchAny(input); if (state.failed) return ;

            	Match(input, Token.UP, null); if (state.failed) return ;

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 15, joinHint_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "joinHint"


    // $ANTLR start "joinOn"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:445:1: joinOn : ^( ON pred ) ;
    public void joinOn() // throws RecognitionException [1]
    {   
        int joinOn_StartIndex = input.Index();
        SqlResolve.pred_return pred39 = default(SqlResolve.pred_return);


        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 16) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:446:5: ( ^( ON pred ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:446:7: ^( ON pred )
            {
            	Match(input,ON,FOLLOW_ON_in_joinOn1437); if (state.failed) return ;

            	Match(input, Token.DOWN, null); if (state.failed) return ;
            	PushFollow(FOLLOW_pred_in_joinOn1439);
            	pred39 = pred();
            	state.followingStackPointer--;
            	if (state.failed) return ;

            	Match(input, Token.UP, null); if (state.failed) return ;
            	if ( (state.backtracking==0) )
            	{

            	          current.addJoinPredicate(((pred39 != null) ? ((CommonTree)pred39.Start) : null));
            	      
            	}

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 16, joinOn_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "joinOn"


    // $ANTLR start "subTableSource"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:452:1: subTableSource : ( ^( TABLE dbObject (a= alias1 )? ) | ^( TABLE subQuery (a= alias1 ) ) | ^( JOIN ( joinType )? ( joinHint )? subTableSource subTableSource joinOn ) | ^( TABLEFUNCTION . ( alias1 )? ) );
    public void subTableSource() // throws RecognitionException [1]
    {   
        int subTableSource_StartIndex = input.Index();
        String a = default(String);

        SqlResolve.dbObject_return dbObject40 = default(SqlResolve.dbObject_return);

        SqlResolve.subQuery_return subQuery41 = default(SqlResolve.subQuery_return);


        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 17) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:453:5: ( ^( TABLE dbObject (a= alias1 )? ) | ^( TABLE subQuery (a= alias1 ) ) | ^( JOIN ( joinType )? ( joinHint )? subTableSource subTableSource joinOn ) | ^( TABLEFUNCTION . ( alias1 )? ) )
            int alt34 = 4;
            switch ( input.LA(1) ) 
            {
            case TABLE:
            	{
                int LA34_1 = input.LA(2);

                if ( (LA34_1 == DOWN) )
                {
                    int LA34_4 = input.LA(3);

                    if ( (LA34_4 == OBJECT) )
                    {
                        alt34 = 1;
                    }
                    else if ( (LA34_4 == QUERY) )
                    {
                        alt34 = 2;
                    }
                    else 
                    {
                        if ( state.backtracking > 0 ) {state.failed = true; return ;}
                        NoViableAltException nvae_d34s4 =
                            new NoViableAltException("", 34, 4, input);

                        throw nvae_d34s4;
                    }
                }
                else 
                {
                    if ( state.backtracking > 0 ) {state.failed = true; return ;}
                    NoViableAltException nvae_d34s1 =
                        new NoViableAltException("", 34, 1, input);

                    throw nvae_d34s1;
                }
                }
                break;
            case JOIN:
            	{
                alt34 = 3;
                }
                break;
            case TABLEFUNCTION:
            	{
                alt34 = 4;
                }
                break;
            	default:
            	    if ( state.backtracking > 0 ) {state.failed = true; return ;}
            	    NoViableAltException nvae_d34s0 =
            	        new NoViableAltException("", 34, 0, input);

            	    throw nvae_d34s0;
            }

            switch (alt34) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:453:7: ^( TABLE dbObject (a= alias1 )? )
                    {
                    	Match(input,TABLE,FOLLOW_TABLE_in_subTableSource1464); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_dbObject_in_subTableSource1466);
                    	dbObject40 = dbObject();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:453:24: (a= alias1 )?
                    	int alt30 = 2;
                    	int LA30_0 = input.LA(1);

                    	if ( (LA30_0 == ALIAS) )
                    	{
                    	    alt30 = 1;
                    	}
                    	switch (alt30) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:453:25: a= alias1
                    	        {
                    	        	PushFollow(FOLLOW_alias1_in_subTableSource1471);
                    	        	a = alias1();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          String t = ( a == null ) ? null : a;
                    	          String[] x = (String[])((dbObject40 != null) ? dbObject40.obj : default(String[]));

                    	          // is it a base table?
                    	          // if not found, it must be a predefined relation
                    	          String relName = x[x.Length - 1];
                    	          RelationSchema s = schema.get(relName);

                    	          //logger.log(Level.FINE,"Relation name = {0}",relName);

                    	          if ( s == null ) {
                    	              // it must be referring previously declared relation

                    	              IView v = resolver.resolve(relName);

                    	              if ( v == null )
                    	                  throw new UnknownTableException("Unknown relation: "+relName);

                    	              // FIXME: put reference here
                    	              viewIndex[ ((dbObject40 != null) ? ((CommonTree)dbObject40.Start) : null) ] = v ;    // referring previous object
                    	          } else {
                    	              SqlQuery.Table tbl = new SqlQuery.Table(current,s);
                    	              if ( t != null ) tbl.setAlias(t);
                    	              current.add(tbl);

                    	              //logger.log(Level.FINE,"Creating table {0}",tbl);

                    	              viewIndex[ ((dbObject40 != null) ? ((CommonTree)dbObject40.Start) : null) ] = tbl ;
                    	          }
                    	      
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:485:7: ^( TABLE subQuery (a= alias1 ) )
                    {
                    	Match(input,TABLE,FOLLOW_TABLE_in_subTableSource1490); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_subQuery_in_subTableSource1492);
                    	subQuery41 = subQuery();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:485:24: (a= alias1 )
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:485:25: a= alias1
                    	{
                    		PushFollow(FOLLOW_alias1_in_subTableSource1497);
                    		a = alias1();
                    		state.followingStackPointer--;
                    		if (state.failed) return ;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          // the instance must be one of 
                    	          String t = a;

                    	          // find r in given from result
                    	          SqlQuery q = current.getSubQueryAtFrom(((subQuery41 != null) ? ((CommonTree)subQuery41.Start) : null));

                    	          if ( q == null )
                    	              throw new UnknownTableException("Unknown subquery: "+((subQuery41 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(subQuery41.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(subQuery41.Start)) : null));

                    	          q.setAlias(t);

                    	          current.addAlias(q);

                    	          viewIndex[ ((subQuery41 != null) ? ((CommonTree)subQuery41.Start) : null) ] = q ;

                    	  //        logger.log(Level.FINE,"Creating subquery {0}",q);
                    	      
                    	}

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:505:7: ^( JOIN ( joinType )? ( joinHint )? subTableSource subTableSource joinOn )
                    {
                    	Match(input,JOIN,FOLLOW_JOIN_in_subTableSource1524); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:505:14: ( joinType )?
                    	int alt31 = 2;
                    	int LA31_0 = input.LA(1);

                    	if ( (LA31_0 == TYPE) )
                    	{
                    	    alt31 = 1;
                    	}
                    	switch (alt31) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: joinType
                    	        {
                    	        	PushFollow(FOLLOW_joinType_in_subTableSource1526);
                    	        	joinType();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}

                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:505:24: ( joinHint )?
                    	int alt32 = 2;
                    	int LA32_0 = input.LA(1);

                    	if ( (LA32_0 == HINT) )
                    	{
                    	    alt32 = 1;
                    	}
                    	switch (alt32) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: joinHint
                    	        {
                    	        	PushFollow(FOLLOW_joinHint_in_subTableSource1529);
                    	        	joinHint();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}

                    	PushFollow(FOLLOW_subTableSource_in_subTableSource1532);
                    	subTableSource();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_subTableSource_in_subTableSource1534);
                    	subTableSource();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_joinOn_in_subTableSource1536);
                    	joinOn();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 4 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:506:7: ^( TABLEFUNCTION . ( alias1 )? )
                    {
                    	Match(input,TABLEFUNCTION,FOLLOW_TABLEFUNCTION_in_subTableSource1546); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	MatchAny(input); if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:506:25: ( alias1 )?
                    	int alt33 = 2;
                    	int LA33_0 = input.LA(1);

                    	if ( (LA33_0 == ALIAS) )
                    	{
                    	    alt33 = 1;
                    	}
                    	switch (alt33) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: alias1
                    	        {
                    	        	PushFollow(FOLLOW_alias1_in_subTableSource1550);
                    	        	alias1();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	         throw new Exception("Doesn't support table function!");
                    	      
                    	}

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 17, subTableSource_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "subTableSource"


    // $ANTLR start "tableSource"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:512:1: tableSource : ( subTableSource )+ ;
    public void tableSource() // throws RecognitionException [1]
    {   
        int tableSource_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 18) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:513:5: ( ( subTableSource )+ )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:513:7: ( subTableSource )+
            {
            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:513:7: ( subTableSource )+
            	int cnt35 = 0;
            	do 
            	{
            	    int alt35 = 2;
            	    int LA35_0 = input.LA(1);

            	    if ( (LA35_0 == TABLE || LA35_0 == TABLEFUNCTION || LA35_0 == JOIN) )
            	    {
            	        alt35 = 1;
            	    }


            	    switch (alt35) 
            		{
            			case 1 :
            			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: subTableSource
            			    {
            			    	PushFollow(FOLLOW_subTableSource_in_tableSource1575);
            			    	subTableSource();
            			    	state.followingStackPointer--;
            			    	if (state.failed) return ;

            			    }
            			    break;

            			default:
            			    if ( cnt35 >= 1 ) goto loop35;
            			    if ( state.backtracking > 0 ) {state.failed = true; return ;}
            		            EarlyExitException eee35 =
            		                new EarlyExitException(35, input);
            		            throw eee35;
            	    }
            	    cnt35++;
            	} while (true);

            	loop35:
            		;	// Stops C# compiler whining that label 'loop35' has no statements


            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 18, tableSource_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "tableSource"


    // $ANTLR start "fromClause"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:516:1: fromClause : ^( FROM tableSource ) ;
    public void fromClause() // throws RecognitionException [1]
    {   
        int fromClause_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 19) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:517:5: ( ^( FROM tableSource ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:517:7: ^( FROM tableSource )
            {
            	Match(input,FROM,FOLLOW_FROM_in_fromClause1594); if (state.failed) return ;

            	Match(input, Token.DOWN, null); if (state.failed) return ;
            	PushFollow(FOLLOW_tableSource_in_fromClause1596);
            	tableSource();
            	state.followingStackPointer--;
            	if (state.failed) return ;

            	Match(input, Token.UP, null); if (state.failed) return ;

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 19, fromClause_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "fromClause"


    // $ANTLR start "whereClause"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:524:1: whereClause : ^( WHERE resolve_predicate ) ;
    public void whereClause() // throws RecognitionException [1]
    {   
        int whereClause_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 20) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:525:5: ( ^( WHERE resolve_predicate ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:525:7: ^( WHERE resolve_predicate )
            {
            	Match(input,WHERE,FOLLOW_WHERE_in_whereClause1618); if (state.failed) return ;

            	Match(input, Token.DOWN, null); if (state.failed) return ;
            	PushFollow(FOLLOW_resolve_predicate_in_whereClause1620);
            	resolve_predicate();
            	state.followingStackPointer--;
            	if (state.failed) return ;

            	Match(input, Token.UP, null); if (state.failed) return ;

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 20, whereClause_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "whereClause"


    // $ANTLR start "groupByClause"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:532:1: groupByClause returns [IList<Column> result] : ^( GROUPBY (a= ALL )? ( argExpr[l] )+ ) ;
    public IList<Column> groupByClause() // throws RecognitionException [1]
    {   
        IList<Column> result = default(IList<Column>);
        int groupByClause_StartIndex = input.Index();
        CommonTree a = null;


                IList<Column> l = new List<Column>();
            
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 21) ) 
    	    {
    	    	return result; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:539:5: ( ^( GROUPBY (a= ALL )? ( argExpr[l] )+ ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:539:7: ^( GROUPBY (a= ALL )? ( argExpr[l] )+ )
            {
            	Match(input,GROUPBY,FOLLOW_GROUPBY_in_groupByClause1664); if (state.failed) return result;

            	Match(input, Token.DOWN, null); if (state.failed) return result;
            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:539:18: (a= ALL )?
            	int alt36 = 2;
            	int LA36_0 = input.LA(1);

            	if ( (LA36_0 == ALL) )
            	{
            	    alt36 = 1;
            	}
            	switch (alt36) 
            	{
            	    case 1 :
            	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: a= ALL
            	        {
            	        	a=(CommonTree)Match(input,ALL,FOLLOW_ALL_in_groupByClause1668); if (state.failed) return result;

            	        }
            	        break;

            	}

            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:539:24: ( argExpr[l] )+
            	int cnt37 = 0;
            	do 
            	{
            	    int alt37 = 2;
            	    int LA37_0 = input.LA(1);

            	    if ( (LA37_0 == ARRAY || LA37_0 == CONSTANT || LA37_0 == OBJECT || LA37_0 == QUERY || (LA37_0 >= SIGN_MINUS && LA37_0 <= SIGN_PLUS) || (LA37_0 >= CASE && LA37_0 <= CAST) || (LA37_0 >= CURRENT_TIMESTAMP && LA37_0 <= CURRENT_USER) || LA37_0 == FUNCTION || LA37_0 == SESSION_USER || LA37_0 == SYSTEM_USER || (LA37_0 >= STAR && LA37_0 <= Variable) || (LA37_0 >= PLUS && LA37_0 <= MOD) || LA37_0 == TILDE) )
            	    {
            	        alt37 = 1;
            	    }


            	    switch (alt37) 
            		{
            			case 1 :
            			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: argExpr[l]
            			    {
            			    	PushFollow(FOLLOW_argExpr_in_groupByClause1671);
            			    	argExpr(l);
            			    	state.followingStackPointer--;
            			    	if (state.failed) return result;

            			    }
            			    break;

            			default:
            			    if ( cnt37 >= 1 ) goto loop37;
            			    if ( state.backtracking > 0 ) {state.failed = true; return result;}
            		            EarlyExitException eee37 =
            		                new EarlyExitException(37, input);
            		            throw eee37;
            	    }
            	    cnt37++;
            	} while (true);

            	loop37:
            		;	// Stops C# compiler whining that label 'loop37' has no statements


            	Match(input, Token.UP, null); if (state.failed) return result;

            }

            if ( (state.backtracking==0) )
            {

                      result =  l;
                  
            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 21, groupByClause_StartIndex); 
            }
        }
        return result;
    }
    // $ANTLR end "groupByClause"


    // $ANTLR start "havingClause"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:546:1: havingClause : ^( HAVING resolve_predicate ) ;
    public void havingClause() // throws RecognitionException [1]
    {   
        int havingClause_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 22) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:547:5: ( ^( HAVING resolve_predicate ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:547:7: ^( HAVING resolve_predicate )
            {
            	Match(input,HAVING,FOLLOW_HAVING_in_havingClause1695); if (state.failed) return ;

            	Match(input, Token.DOWN, null); if (state.failed) return ;
            	PushFollow(FOLLOW_resolve_predicate_in_havingClause1697);
            	resolve_predicate();
            	state.followingStackPointer--;
            	if (state.failed) return ;

            	Match(input, Token.UP, null); if (state.failed) return ;

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 22, havingClause_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "havingClause"


    // $ANTLR start "orderByItem"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:554:1: orderByItem[IList<Order> l] returns [Order result] : ^( ORDER argExpr1 (a= ASC | d= DESC )? ) ;
    public Order orderByItem(IList<Order> l) // throws RecognitionException [1]
    {   
        Order result = default(Order);
        int orderByItem_StartIndex = input.Index();
        CommonTree a = null;
        CommonTree d = null;
        Column argExpr142 = default(Column);



                Order o = null;
            
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 23) ) 
    	    {
    	    	return result; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:562:5: ( ^( ORDER argExpr1 (a= ASC | d= DESC )? ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:562:7: ^( ORDER argExpr1 (a= ASC | d= DESC )? )
            {
            	Match(input,ORDER,FOLLOW_ORDER_in_orderByItem1743); if (state.failed) return result;

            	Match(input, Token.DOWN, null); if (state.failed) return result;
            	PushFollow(FOLLOW_argExpr1_in_orderByItem1745);
            	argExpr142 = argExpr1();
            	state.followingStackPointer--;
            	if (state.failed) return result;
            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:562:24: (a= ASC | d= DESC )?
            	int alt38 = 3;
            	int LA38_0 = input.LA(1);

            	if ( (LA38_0 == ASC) )
            	{
            	    alt38 = 1;
            	}
            	else if ( (LA38_0 == DESC) )
            	{
            	    alt38 = 2;
            	}
            	switch (alt38) 
            	{
            	    case 1 :
            	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:562:25: a= ASC
            	        {
            	        	a=(CommonTree)Match(input,ASC,FOLLOW_ASC_in_orderByItem1750); if (state.failed) return result;

            	        }
            	        break;
            	    case 2 :
            	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:562:31: d= DESC
            	        {
            	        	d=(CommonTree)Match(input,DESC,FOLLOW_DESC_in_orderByItem1754); if (state.failed) return result;

            	        }
            	        break;

            	}


            	Match(input, Token.UP, null); if (state.failed) return result;
            	if ( (state.backtracking==0) )
            	{

            	          o = new Order(argExpr142,( d != null ) ? Order.Ordering.DESC : Order.Ordering.ASC);
            	      
            	}

            }

            if ( (state.backtracking==0) )
            {

                      result =  o;
                      if ( l != null ) l.Add(result);
                  
            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 23, orderByItem_StartIndex); 
            }
        }
        return result;
    }
    // $ANTLR end "orderByItem"


    // $ANTLR start "orderByClause"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:568:1: orderByClause returns [IList<Order> result] : ^( ORDERBY ( orderByItem[l] )+ ) ;
    public IList<Order> orderByClause() // throws RecognitionException [1]
    {   
        IList<Order> result = default(IList<Order>);
        int orderByClause_StartIndex = input.Index();

                IList<Order> l = new List<Order>();
            
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 24) ) 
    	    {
    	    	return result; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:575:5: ( ^( ORDERBY ( orderByItem[l] )+ ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:575:7: ^( ORDERBY ( orderByItem[l] )+ )
            {
            	Match(input,ORDERBY,FOLLOW_ORDERBY_in_orderByClause1803); if (state.failed) return result;

            	Match(input, Token.DOWN, null); if (state.failed) return result;
            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:575:17: ( orderByItem[l] )+
            	int cnt39 = 0;
            	do 
            	{
            	    int alt39 = 2;
            	    int LA39_0 = input.LA(1);

            	    if ( (LA39_0 == ORDER) )
            	    {
            	        alt39 = 1;
            	    }


            	    switch (alt39) 
            		{
            			case 1 :
            			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: orderByItem[l]
            			    {
            			    	PushFollow(FOLLOW_orderByItem_in_orderByClause1805);
            			    	orderByItem(l);
            			    	state.followingStackPointer--;
            			    	if (state.failed) return result;

            			    }
            			    break;

            			default:
            			    if ( cnt39 >= 1 ) goto loop39;
            			    if ( state.backtracking > 0 ) {state.failed = true; return result;}
            		            EarlyExitException eee39 =
            		                new EarlyExitException(39, input);
            		            throw eee39;
            	    }
            	    cnt39++;
            	} while (true);

            	loop39:
            		;	// Stops C# compiler whining that label 'loop39' has no statements


            	Match(input, Token.UP, null); if (state.failed) return result;

            }

            if ( (state.backtracking==0) )
            {

                      result =  l;
                  
            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 24, orderByClause_StartIndex); 
            }
        }
        return result;
    }
    // $ANTLR end "orderByClause"


    // $ANTLR start "resolve_caseWhen"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:580:1: resolve_caseWhen : ( ^( WHEN resolve_expr resolve_expr ) | ^( WHEN resolve_predicate resolve_expr ) );
    public void resolve_caseWhen() // throws RecognitionException [1]
    {   
        int resolve_caseWhen_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 25) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:587:5: ( ^( WHEN resolve_expr resolve_expr ) | ^( WHEN resolve_predicate resolve_expr ) )
            int alt40 = 2;
            int LA40_0 = input.LA(1);

            if ( (LA40_0 == WHEN) )
            {
                int LA40_1 = input.LA(2);

                if ( (LA40_1 == DOWN) )
                {
                    int LA40_2 = input.LA(3);

                    if ( (LA40_2 == ARRAY || LA40_2 == CONSTANT || LA40_2 == OBJECT || LA40_2 == QUERY || (LA40_2 >= SIGN_MINUS && LA40_2 <= SIGN_PLUS) || (LA40_2 >= CASE && LA40_2 <= CAST) || (LA40_2 >= CURRENT_TIMESTAMP && LA40_2 <= CURRENT_USER) || LA40_2 == FUNCTION || LA40_2 == SESSION_USER || LA40_2 == SYSTEM_USER || (LA40_2 >= STAR && LA40_2 <= Variable) || (LA40_2 >= PLUS && LA40_2 <= MOD) || LA40_2 == TILDE) )
                    {
                        alt40 = 1;
                    }
                    else if ( (LA40_2 == AND || LA40_2 == BETWEEN || LA40_2 == EXISTS || LA40_2 == IN || LA40_2 == IS || LA40_2 == LIKE || LA40_2 == NOT || LA40_2 == OR || LA40_2 == ASSIGNEQUAL || (LA40_2 >= NOTEQUAL1 && LA40_2 <= GREATERTHAN)) )
                    {
                        alt40 = 2;
                    }
                    else 
                    {
                        if ( state.backtracking > 0 ) {state.failed = true; return ;}
                        NoViableAltException nvae_d40s2 =
                            new NoViableAltException("", 40, 2, input);

                        throw nvae_d40s2;
                    }
                }
                else 
                {
                    if ( state.backtracking > 0 ) {state.failed = true; return ;}
                    NoViableAltException nvae_d40s1 =
                        new NoViableAltException("", 40, 1, input);

                    throw nvae_d40s1;
                }
            }
            else 
            {
                if ( state.backtracking > 0 ) {state.failed = true; return ;}
                NoViableAltException nvae_d40s0 =
                    new NoViableAltException("", 40, 0, input);

                throw nvae_d40s0;
            }
            switch (alt40) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:587:7: ^( WHEN resolve_expr resolve_expr )
                    {
                    	Match(input,WHEN,FOLLOW_WHEN_in_resolve_caseWhen1831); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_caseWhen1833);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_caseWhen1835);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:588:7: ^( WHEN resolve_predicate resolve_expr )
                    {
                    	Match(input,WHEN,FOLLOW_WHEN_in_resolve_caseWhen1845); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_predicate_in_resolve_caseWhen1847);
                    	resolve_predicate();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_caseWhen1849);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 25, resolve_caseWhen_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "resolve_caseWhen"


    // $ANTLR start "resolve_caseElse"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:591:1: resolve_caseElse : ^( ELSE resolve_expr ) ;
    public void resolve_caseElse() // throws RecognitionException [1]
    {   
        int resolve_caseElse_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 26) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:592:5: ( ^( ELSE resolve_expr ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:592:7: ^( ELSE resolve_expr )
            {
            	Match(input,ELSE,FOLLOW_ELSE_in_resolve_caseElse1868); if (state.failed) return ;

            	Match(input, Token.DOWN, null); if (state.failed) return ;
            	PushFollow(FOLLOW_resolve_expr_in_resolve_caseElse1870);
            	resolve_expr();
            	state.followingStackPointer--;
            	if (state.failed) return ;

            	Match(input, Token.UP, null); if (state.failed) return ;

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 26, resolve_caseElse_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "resolve_caseElse"


    // $ANTLR start "resolve_setPred"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:595:1: resolve_setPred : ( ^( ALL resolve_expr ) | ^( SOME resolve_expr ) | ^( ANY resolve_expr ) | resolve_expr );
    public void resolve_setPred() // throws RecognitionException [1]
    {   
        int resolve_setPred_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 27) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:596:5: ( ^( ALL resolve_expr ) | ^( SOME resolve_expr ) | ^( ANY resolve_expr ) | resolve_expr )
            int alt41 = 4;
            switch ( input.LA(1) ) 
            {
            case ALL:
            	{
                alt41 = 1;
                }
                break;
            case SOME:
            	{
                alt41 = 2;
                }
                break;
            case ANY:
            	{
                alt41 = 3;
                }
                break;
            case ARRAY:
            case CONSTANT:
            case OBJECT:
            case QUERY:
            case SIGN_MINUS:
            case SIGN_PLUS:
            case CASE:
            case CAST:
            case CURRENT_TIMESTAMP:
            case CURRENT_USER:
            case FUNCTION:
            case SESSION_USER:
            case SYSTEM_USER:
            case STAR:
            case Variable:
            case PLUS:
            case MINUS:
            case AMPERSAND:
            case BITWISEOR:
            case BITWISEXOR:
            case DIVIDE:
            case MOD:
            case TILDE:
            	{
                alt41 = 4;
                }
                break;
            	default:
            	    if ( state.backtracking > 0 ) {state.failed = true; return ;}
            	    NoViableAltException nvae_d41s0 =
            	        new NoViableAltException("", 41, 0, input);

            	    throw nvae_d41s0;
            }

            switch (alt41) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:596:7: ^( ALL resolve_expr )
                    {
                    	Match(input,ALL,FOLLOW_ALL_in_resolve_setPred1889); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_setPred1891);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:597:7: ^( SOME resolve_expr )
                    {
                    	Match(input,SOME,FOLLOW_SOME_in_resolve_setPred1901); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_setPred1903);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:598:7: ^( ANY resolve_expr )
                    {
                    	Match(input,ANY,FOLLOW_ANY_in_resolve_setPred1913); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_setPred1915);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 4 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:599:7: resolve_expr
                    {
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_setPred1924);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 27, resolve_setPred_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "resolve_setPred"


    // $ANTLR start "resolve_predicate"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:603:1: resolve_predicate : ( ^( AND resolve_predicate resolve_predicate ) | ^( OR resolve_predicate resolve_predicate ) | ^( NOT resolve_predicate ) | ^( IS resolve_expr NULL ) | ^( LIKE resolve_expr resolve_expr ) | ^( BETWEEN resolve_expr resolve_expr resolve_expr ) | ^( IN resolve_expr resolve_expr ) | ^( EXISTS resolve_expr ) | ^( ASSIGNEQUAL resolve_setPred resolve_setPred ) | ^( NOTEQUAL1 resolve_setPred resolve_setPred ) | ^( NOTEQUAL2 resolve_setPred resolve_setPred ) | ^( LESSTHANOREQUALTO1 resolve_setPred resolve_setPred ) | ^( LESSTHANOREQUALTO2 resolve_setPred resolve_setPred ) | ^( LESSTHAN resolve_setPred resolve_setPred ) | ^( GREATERTHANOREQUALTO1 resolve_setPred resolve_setPred ) | ^( GREATERTHANOREQUALTO2 resolve_setPred resolve_setPred ) | ^( GREATERTHAN resolve_setPred resolve_setPred ) );
    public void resolve_predicate() // throws RecognitionException [1]
    {   
        int resolve_predicate_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 28) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:604:5: ( ^( AND resolve_predicate resolve_predicate ) | ^( OR resolve_predicate resolve_predicate ) | ^( NOT resolve_predicate ) | ^( IS resolve_expr NULL ) | ^( LIKE resolve_expr resolve_expr ) | ^( BETWEEN resolve_expr resolve_expr resolve_expr ) | ^( IN resolve_expr resolve_expr ) | ^( EXISTS resolve_expr ) | ^( ASSIGNEQUAL resolve_setPred resolve_setPred ) | ^( NOTEQUAL1 resolve_setPred resolve_setPred ) | ^( NOTEQUAL2 resolve_setPred resolve_setPred ) | ^( LESSTHANOREQUALTO1 resolve_setPred resolve_setPred ) | ^( LESSTHANOREQUALTO2 resolve_setPred resolve_setPred ) | ^( LESSTHAN resolve_setPred resolve_setPred ) | ^( GREATERTHANOREQUALTO1 resolve_setPred resolve_setPred ) | ^( GREATERTHANOREQUALTO2 resolve_setPred resolve_setPred ) | ^( GREATERTHAN resolve_setPred resolve_setPred ) )
            int alt42 = 17;
            switch ( input.LA(1) ) 
            {
            case AND:
            	{
                alt42 = 1;
                }
                break;
            case OR:
            	{
                alt42 = 2;
                }
                break;
            case NOT:
            	{
                alt42 = 3;
                }
                break;
            case IS:
            	{
                alt42 = 4;
                }
                break;
            case LIKE:
            	{
                alt42 = 5;
                }
                break;
            case BETWEEN:
            	{
                alt42 = 6;
                }
                break;
            case IN:
            	{
                alt42 = 7;
                }
                break;
            case EXISTS:
            	{
                alt42 = 8;
                }
                break;
            case ASSIGNEQUAL:
            	{
                alt42 = 9;
                }
                break;
            case NOTEQUAL1:
            	{
                alt42 = 10;
                }
                break;
            case NOTEQUAL2:
            	{
                alt42 = 11;
                }
                break;
            case LESSTHANOREQUALTO1:
            	{
                alt42 = 12;
                }
                break;
            case LESSTHANOREQUALTO2:
            	{
                alt42 = 13;
                }
                break;
            case LESSTHAN:
            	{
                alt42 = 14;
                }
                break;
            case GREATERTHANOREQUALTO1:
            	{
                alt42 = 15;
                }
                break;
            case GREATERTHANOREQUALTO2:
            	{
                alt42 = 16;
                }
                break;
            case GREATERTHAN:
            	{
                alt42 = 17;
                }
                break;
            	default:
            	    if ( state.backtracking > 0 ) {state.failed = true; return ;}
            	    NoViableAltException nvae_d42s0 =
            	        new NoViableAltException("", 42, 0, input);

            	    throw nvae_d42s0;
            }

            switch (alt42) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:604:7: ^( AND resolve_predicate resolve_predicate )
                    {
                    	Match(input,AND,FOLLOW_AND_in_resolve_predicate1943); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_predicate_in_resolve_predicate1945);
                    	resolve_predicate();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_predicate_in_resolve_predicate1947);
                    	resolve_predicate();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:605:7: ^( OR resolve_predicate resolve_predicate )
                    {
                    	Match(input,OR,FOLLOW_OR_in_resolve_predicate1957); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_predicate_in_resolve_predicate1959);
                    	resolve_predicate();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_predicate_in_resolve_predicate1961);
                    	resolve_predicate();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:606:7: ^( NOT resolve_predicate )
                    {
                    	Match(input,NOT,FOLLOW_NOT_in_resolve_predicate1971); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_predicate_in_resolve_predicate1973);
                    	resolve_predicate();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 4 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:607:7: ^( IS resolve_expr NULL )
                    {
                    	Match(input,IS,FOLLOW_IS_in_resolve_predicate1983); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_predicate1985);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	Match(input,NULL,FOLLOW_NULL_in_resolve_predicate1987); if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 5 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:608:7: ^( LIKE resolve_expr resolve_expr )
                    {
                    	Match(input,LIKE,FOLLOW_LIKE_in_resolve_predicate1997); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_predicate1999);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_predicate2001);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 6 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:609:7: ^( BETWEEN resolve_expr resolve_expr resolve_expr )
                    {
                    	Match(input,BETWEEN,FOLLOW_BETWEEN_in_resolve_predicate2011); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_predicate2013);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_predicate2015);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_predicate2017);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 7 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:610:7: ^( IN resolve_expr resolve_expr )
                    {
                    	Match(input,IN,FOLLOW_IN_in_resolve_predicate2027); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_predicate2029);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_predicate2031);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 8 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:611:7: ^( EXISTS resolve_expr )
                    {
                    	Match(input,EXISTS,FOLLOW_EXISTS_in_resolve_predicate2041); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_predicate2043);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 9 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:612:7: ^( ASSIGNEQUAL resolve_setPred resolve_setPred )
                    {
                    	Match(input,ASSIGNEQUAL,FOLLOW_ASSIGNEQUAL_in_resolve_predicate2053); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2055);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2057);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 10 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:613:7: ^( NOTEQUAL1 resolve_setPred resolve_setPred )
                    {
                    	Match(input,NOTEQUAL1,FOLLOW_NOTEQUAL1_in_resolve_predicate2067); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2069);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2071);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 11 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:614:7: ^( NOTEQUAL2 resolve_setPred resolve_setPred )
                    {
                    	Match(input,NOTEQUAL2,FOLLOW_NOTEQUAL2_in_resolve_predicate2081); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2083);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2085);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 12 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:615:7: ^( LESSTHANOREQUALTO1 resolve_setPred resolve_setPred )
                    {
                    	Match(input,LESSTHANOREQUALTO1,FOLLOW_LESSTHANOREQUALTO1_in_resolve_predicate2095); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2097);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2099);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 13 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:616:7: ^( LESSTHANOREQUALTO2 resolve_setPred resolve_setPred )
                    {
                    	Match(input,LESSTHANOREQUALTO2,FOLLOW_LESSTHANOREQUALTO2_in_resolve_predicate2109); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2111);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2113);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 14 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:617:7: ^( LESSTHAN resolve_setPred resolve_setPred )
                    {
                    	Match(input,LESSTHAN,FOLLOW_LESSTHAN_in_resolve_predicate2123); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2125);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2127);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 15 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:618:7: ^( GREATERTHANOREQUALTO1 resolve_setPred resolve_setPred )
                    {
                    	Match(input,GREATERTHANOREQUALTO1,FOLLOW_GREATERTHANOREQUALTO1_in_resolve_predicate2137); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2139);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2141);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 16 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:619:7: ^( GREATERTHANOREQUALTO2 resolve_setPred resolve_setPred )
                    {
                    	Match(input,GREATERTHANOREQUALTO2,FOLLOW_GREATERTHANOREQUALTO2_in_resolve_predicate2151); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2153);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2155);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 17 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:620:7: ^( GREATERTHAN resolve_setPred resolve_setPred )
                    {
                    	Match(input,GREATERTHAN,FOLLOW_GREATERTHAN_in_resolve_predicate2165); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2167);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_setPred_in_resolve_predicate2169);
                    	resolve_setPred();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 28, resolve_predicate_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "resolve_predicate"


    // $ANTLR start "resolve_array"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:623:1: resolve_array : array ;
    public void resolve_array() // throws RecognitionException [1]
    {   
        int resolve_array_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 29) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:625:5: ( array )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:625:7: array
            {
            	PushFollow(FOLLOW_array_in_resolve_array2189);
            	array();
            	state.followingStackPointer--;
            	if (state.failed) return ;

            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 29, resolve_array_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "resolve_array"


    // $ANTLR start "resolve_expr"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:628:1: resolve_expr : ( dbObject | subQuery | function | ^( CASE ( resolve_expr )? ( resolve_caseWhen )+ ( resolve_caseElse )? ) | ^( CAST resolve_expr identifier ( Integer ( Integer )? )? ) | parameterlessFunction | ^( CONSTANT constant ) | Variable | ^( PLUS resolve_expr resolve_expr ) | ^( MINUS resolve_expr resolve_expr ) | ^( STAR resolve_expr resolve_expr ) | ^( DIVIDE resolve_expr resolve_expr ) | ^( MOD resolve_expr resolve_expr ) | ^( AMPERSAND resolve_expr resolve_expr ) | ^( BITWISEOR resolve_expr resolve_expr ) | ^( BITWISEXOR resolve_expr resolve_expr ) | ^( TILDE resolve_expr ) | ^( SIGN_PLUS resolve_expr ) | ^( SIGN_MINUS resolve_expr ) | resolve_array );
    public void resolve_expr() // throws RecognitionException [1]
    {   
        int resolve_expr_StartIndex = input.Index();
        CommonTree CONSTANT46 = null;
        SqlResolve.dbObject_return dbObject43 = default(SqlResolve.dbObject_return);

        SqlResolve.subQuery_return subQuery44 = default(SqlResolve.subQuery_return);

        SqlResolve.function_return function45 = default(SqlResolve.function_return);

        SqlResolve.constant_return constant47 = default(SqlResolve.constant_return);


        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 30) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:629:5: ( dbObject | subQuery | function | ^( CASE ( resolve_expr )? ( resolve_caseWhen )+ ( resolve_caseElse )? ) | ^( CAST resolve_expr identifier ( Integer ( Integer )? )? ) | parameterlessFunction | ^( CONSTANT constant ) | Variable | ^( PLUS resolve_expr resolve_expr ) | ^( MINUS resolve_expr resolve_expr ) | ^( STAR resolve_expr resolve_expr ) | ^( DIVIDE resolve_expr resolve_expr ) | ^( MOD resolve_expr resolve_expr ) | ^( AMPERSAND resolve_expr resolve_expr ) | ^( BITWISEOR resolve_expr resolve_expr ) | ^( BITWISEXOR resolve_expr resolve_expr ) | ^( TILDE resolve_expr ) | ^( SIGN_PLUS resolve_expr ) | ^( SIGN_MINUS resolve_expr ) | resolve_array )
            int alt48 = 20;
            switch ( input.LA(1) ) 
            {
            case OBJECT:
            	{
                alt48 = 1;
                }
                break;
            case QUERY:
            	{
                alt48 = 2;
                }
                break;
            case FUNCTION:
            	{
                alt48 = 3;
                }
                break;
            case CASE:
            	{
                alt48 = 4;
                }
                break;
            case CAST:
            	{
                alt48 = 5;
                }
                break;
            case CURRENT_TIMESTAMP:
            case CURRENT_USER:
            case SESSION_USER:
            case SYSTEM_USER:
            	{
                alt48 = 6;
                }
                break;
            case CONSTANT:
            	{
                alt48 = 7;
                }
                break;
            case Variable:
            	{
                alt48 = 8;
                }
                break;
            case PLUS:
            	{
                alt48 = 9;
                }
                break;
            case MINUS:
            	{
                alt48 = 10;
                }
                break;
            case STAR:
            	{
                alt48 = 11;
                }
                break;
            case DIVIDE:
            	{
                alt48 = 12;
                }
                break;
            case MOD:
            	{
                alt48 = 13;
                }
                break;
            case AMPERSAND:
            	{
                alt48 = 14;
                }
                break;
            case BITWISEOR:
            	{
                alt48 = 15;
                }
                break;
            case BITWISEXOR:
            	{
                alt48 = 16;
                }
                break;
            case TILDE:
            	{
                alt48 = 17;
                }
                break;
            case SIGN_PLUS:
            	{
                alt48 = 18;
                }
                break;
            case SIGN_MINUS:
            	{
                alt48 = 19;
                }
                break;
            case ARRAY:
            	{
                alt48 = 20;
                }
                break;
            	default:
            	    if ( state.backtracking > 0 ) {state.failed = true; return ;}
            	    NoViableAltException nvae_d48s0 =
            	        new NoViableAltException("", 48, 0, input);

            	    throw nvae_d48s0;
            }

            switch (alt48) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:629:7: dbObject
                    {
                    	PushFollow(FOLLOW_dbObject_in_resolve_expr2206);
                    	dbObject43 = dbObject();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          String[] x = (String[])((dbObject43 != null) ? dbObject43.obj : default(String[]));
                    	          String relName = ( x.Length > 1 ) ? x[x.Length - 2] : null;
                    	          String colName = x[x.Length - 1];

                    	          Column c = resolver.resolve(relName,colName);
                    	          if ( c == null )
                    	              throw new UnknownColumnException(string.Join(",", x));

                    	          // this is directly from the table or subqueries and won't be
                    	          // exposed to other queries

                    	          colIndex[ ((dbObject43 != null) ? ((CommonTree)dbObject43.Start) : null) ] = c ;
                    	      
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:644:7: subQuery
                    {
                    	PushFollow(FOLLOW_subQuery_in_resolve_expr2220);
                    	subQuery44 = subQuery();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          // find r in given from result
                    	          SqlQuery q = current.getSubQuery(((subQuery44 != null) ? ((CommonTree)subQuery44.Start) : null));

                    	          if ( q == null )
                    	              throw new UnknownTableException("Unknown subquery: "+((subQuery44 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(subQuery44.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(subQuery44.Start)) : null));

                    	          colIndex[ ((subQuery44 != null) ? ((CommonTree)subQuery44.Start) : null) ] =  new Column.Query(current,q) ;
                    	          viewIndex[ ((subQuery44 != null) ? ((CommonTree)subQuery44.Start) : null) ] = q ;
                    	      
                    	}

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:655:7: function
                    {
                    	PushFollow(FOLLOW_function_in_resolve_expr2234);
                    	function45 = function();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          colIndex[((function45 != null) ? ((CommonTree)function45.Start) : null)] =  ((function45 != null) ? function45.result : default(Column.Function)) ;
                    	      
                    	}

                    }
                    break;
                case 4 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:659:7: ^( CASE ( resolve_expr )? ( resolve_caseWhen )+ ( resolve_caseElse )? )
                    {
                    	Match(input,CASE,FOLLOW_CASE_in_resolve_expr2249); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:659:14: ( resolve_expr )?
                    	int alt43 = 2;
                    	int LA43_0 = input.LA(1);

                    	if ( (LA43_0 == ARRAY || LA43_0 == CONSTANT || LA43_0 == OBJECT || LA43_0 == QUERY || (LA43_0 >= SIGN_MINUS && LA43_0 <= SIGN_PLUS) || (LA43_0 >= CASE && LA43_0 <= CAST) || (LA43_0 >= CURRENT_TIMESTAMP && LA43_0 <= CURRENT_USER) || LA43_0 == FUNCTION || LA43_0 == SESSION_USER || LA43_0 == SYSTEM_USER || (LA43_0 >= STAR && LA43_0 <= Variable) || (LA43_0 >= PLUS && LA43_0 <= MOD) || LA43_0 == TILDE) )
                    	{
                    	    alt43 = 1;
                    	}
                    	switch (alt43) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: resolve_expr
                    	        {
                    	        	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2251);
                    	        	resolve_expr();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}

                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:659:28: ( resolve_caseWhen )+
                    	int cnt44 = 0;
                    	do 
                    	{
                    	    int alt44 = 2;
                    	    int LA44_0 = input.LA(1);

                    	    if ( (LA44_0 == WHEN) )
                    	    {
                    	        alt44 = 1;
                    	    }


                    	    switch (alt44) 
                    		{
                    			case 1 :
                    			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: resolve_caseWhen
                    			    {
                    			    	PushFollow(FOLLOW_resolve_caseWhen_in_resolve_expr2254);
                    			    	resolve_caseWhen();
                    			    	state.followingStackPointer--;
                    			    	if (state.failed) return ;

                    			    }
                    			    break;

                    			default:
                    			    if ( cnt44 >= 1 ) goto loop44;
                    			    if ( state.backtracking > 0 ) {state.failed = true; return ;}
                    		            EarlyExitException eee44 =
                    		                new EarlyExitException(44, input);
                    		            throw eee44;
                    	    }
                    	    cnt44++;
                    	} while (true);

                    	loop44:
                    		;	// Stops C# compiler whining that label 'loop44' has no statements

                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:659:46: ( resolve_caseElse )?
                    	int alt45 = 2;
                    	int LA45_0 = input.LA(1);

                    	if ( (LA45_0 == ELSE) )
                    	{
                    	    alt45 = 1;
                    	}
                    	switch (alt45) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: resolve_caseElse
                    	        {
                    	        	PushFollow(FOLLOW_resolve_caseElse_in_resolve_expr2257);
                    	        	resolve_caseElse();
                    	        	state.followingStackPointer--;
                    	        	if (state.failed) return ;

                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 5 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:660:7: ^( CAST resolve_expr identifier ( Integer ( Integer )? )? )
                    {
                    	Match(input,CAST,FOLLOW_CAST_in_resolve_expr2268); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2270);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_identifier_in_resolve_expr2272);
                    	identifier();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:660:38: ( Integer ( Integer )? )?
                    	int alt47 = 2;
                    	int LA47_0 = input.LA(1);

                    	if ( (LA47_0 == Integer) )
                    	{
                    	    alt47 = 1;
                    	}
                    	switch (alt47) 
                    	{
                    	    case 1 :
                    	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:660:39: Integer ( Integer )?
                    	        {
                    	        	Match(input,Integer,FOLLOW_Integer_in_resolve_expr2275); if (state.failed) return ;
                    	        	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:660:47: ( Integer )?
                    	        	int alt46 = 2;
                    	        	int LA46_0 = input.LA(1);

                    	        	if ( (LA46_0 == Integer) )
                    	        	{
                    	        	    alt46 = 1;
                    	        	}
                    	        	switch (alt46) 
                    	        	{
                    	        	    case 1 :
                    	        	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: Integer
                    	        	        {
                    	        	        	Match(input,Integer,FOLLOW_Integer_in_resolve_expr2277); if (state.failed) return ;

                    	        	        }
                    	        	        break;

                    	        	}


                    	        }
                    	        break;

                    	}


                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 6 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:661:7: parameterlessFunction
                    {
                    	PushFollow(FOLLOW_parameterlessFunction_in_resolve_expr2290);
                    	parameterlessFunction();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    }
                    break;
                case 7 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:662:7: ^( CONSTANT constant )
                    {
                    	CONSTANT46=(CommonTree)Match(input,CONSTANT,FOLLOW_CONSTANT_in_resolve_expr2299); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_constant_in_resolve_expr2301);
                    	constant47 = constant();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	          colIndex[CONSTANT46] = new Column.Constant(current,CONSTANT46,((constant47 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(constant47.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(constant47.Start)) : null),((constant47 != null) ? constant47.result : default(Object))) ;
                    	      
                    	}

                    }
                    break;
                case 8 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:666:7: Variable
                    {
                    	Match(input,Variable,FOLLOW_Variable_in_resolve_expr2316); if (state.failed) return ;

                    }
                    break;
                case 9 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:667:7: ^( PLUS resolve_expr resolve_expr )
                    {
                    	Match(input,PLUS,FOLLOW_PLUS_in_resolve_expr2325); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2327);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2329);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 10 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:668:7: ^( MINUS resolve_expr resolve_expr )
                    {
                    	Match(input,MINUS,FOLLOW_MINUS_in_resolve_expr2339); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2341);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2343);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 11 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:669:7: ^( STAR resolve_expr resolve_expr )
                    {
                    	Match(input,STAR,FOLLOW_STAR_in_resolve_expr2353); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2355);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2357);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 12 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:670:7: ^( DIVIDE resolve_expr resolve_expr )
                    {
                    	Match(input,DIVIDE,FOLLOW_DIVIDE_in_resolve_expr2367); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2369);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2371);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 13 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:671:7: ^( MOD resolve_expr resolve_expr )
                    {
                    	Match(input,MOD,FOLLOW_MOD_in_resolve_expr2381); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2383);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2385);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 14 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:672:7: ^( AMPERSAND resolve_expr resolve_expr )
                    {
                    	Match(input,AMPERSAND,FOLLOW_AMPERSAND_in_resolve_expr2395); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2397);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2399);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 15 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:673:7: ^( BITWISEOR resolve_expr resolve_expr )
                    {
                    	Match(input,BITWISEOR,FOLLOW_BITWISEOR_in_resolve_expr2409); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2411);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2413);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 16 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:674:7: ^( BITWISEXOR resolve_expr resolve_expr )
                    {
                    	Match(input,BITWISEXOR,FOLLOW_BITWISEXOR_in_resolve_expr2423); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2425);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2427);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 17 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:675:7: ^( TILDE resolve_expr )
                    {
                    	Match(input,TILDE,FOLLOW_TILDE_in_resolve_expr2437); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2439);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 18 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:676:7: ^( SIGN_PLUS resolve_expr )
                    {
                    	Match(input,SIGN_PLUS,FOLLOW_SIGN_PLUS_in_resolve_expr2449); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2451);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 19 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:677:7: ^( SIGN_MINUS resolve_expr )
                    {
                    	Match(input,SIGN_MINUS,FOLLOW_SIGN_MINUS_in_resolve_expr2461); if (state.failed) return ;

                    	Match(input, Token.DOWN, null); if (state.failed) return ;
                    	PushFollow(FOLLOW_resolve_expr_in_resolve_expr2463);
                    	resolve_expr();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    	Match(input, Token.UP, null); if (state.failed) return ;

                    }
                    break;
                case 20 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:678:7: resolve_array
                    {
                    	PushFollow(FOLLOW_resolve_array_in_resolve_expr2472);
                    	resolve_array();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 30, resolve_expr_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "resolve_expr"


    // $ANTLR start "dbObjectName"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:685:1: dbObjectName : ( identifier | IDENTITYCOL | ROWGUIDCOL | keywordAsIdentifier );
    public void dbObjectName() // throws RecognitionException [1]
    {   
        int dbObjectName_StartIndex = input.Index();
        CommonTree IDENTITYCOL49 = null;
        CommonTree ROWGUIDCOL50 = null;
        SqlResolve.identifier_return identifier48 = default(SqlResolve.identifier_return);

        SqlResolve.keywordAsIdentifier_return keywordAsIdentifier51 = default(SqlResolve.keywordAsIdentifier_return);


        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 31) ) 
    	    {
    	    	return ; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:687:5: ( identifier | IDENTITYCOL | ROWGUIDCOL | keywordAsIdentifier )
            int alt49 = 4;
            switch ( input.LA(1) ) 
            {
            case NonQuotedIdentifier:
            case QuotedIdentifier:
            	{
                alt49 = 1;
                }
                break;
            case IDENTITYCOL:
            	{
                alt49 = 2;
                }
                break;
            case ROWGUIDCOL:
            	{
                alt49 = 3;
                }
                break;
            case AUTO:
            case BASE64:
            case BINARY:
            case CAST:
            case CONCAT:
            case CUBE:
            case ELEMENTS:
            case EXPAND:
            case EXPLICIT:
            case FAST:
            case FASTFIRSTROW:
            case FORCE:
            case HASH:
            case KEEP:
            case KEEPFIXED:
            case LOOP:
            case MAXDOP:
            case MERGE:
            case NOLOCK:
            case PAGLOCK:
            case RAW:
            case READCOMMITED:
            case READPAST:
            case READUNCOMMITED:
            case REMOTE:
            case REPEATABLEREAD:
            case ROBUST:
            case ROLLUP:
            case ROWLOCK:
            case SERIALIZABLE:
            case TABLOCK:
            case TABLOCKX:
            case TIES:
            case UPDLOCK:
            case VIEWS:
            case XLOCK:
            case XML:
            case XMLDATA:
            	{
                alt49 = 4;
                }
                break;
            	default:
            	    if ( state.backtracking > 0 ) {state.failed = true; return ;}
            	    NoViableAltException nvae_d49s0 =
            	        new NoViableAltException("", 49, 0, input);

            	    throw nvae_d49s0;
            }

            switch (alt49) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:687:7: identifier
                    {
                    	PushFollow(FOLLOW_identifier_in_dbObjectName2497);
                    	identifier48 = identifier();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{

                    	      /*
                    	        String s = ((identifier48 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(identifier48.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(identifier48.Start)) : null);
                    	        s = s.trim().ToLower();
                    	        boolean q = s.charAt(0) == '[' || s.charAt(0) == '"';
                    	        int start = q ? 1 : 0;
                    	        int end = q ? s.length() - 1 : s.length();
                    	        */
                    	        ((dbObject_scope)dbObject_stack.Peek()).sbuf.Append(((identifier48 != null) ? identifier48.result : default(String)));
                    	      
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:697:7: IDENTITYCOL
                    {
                    	IDENTITYCOL49=(CommonTree)Match(input,IDENTITYCOL,FOLLOW_IDENTITYCOL_in_dbObjectName2507); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{
                    	   ((dbObject_scope)dbObject_stack.Peek()).sbuf.Append(((IDENTITYCOL49 != null) ? IDENTITYCOL49.Text : null)); 
                    	}

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:698:7: ROWGUIDCOL
                    {
                    	ROWGUIDCOL50=(CommonTree)Match(input,ROWGUIDCOL,FOLLOW_ROWGUIDCOL_in_dbObjectName2517); if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{
                    	   ((dbObject_scope)dbObject_stack.Peek()).sbuf.Append(((ROWGUIDCOL50 != null) ? ROWGUIDCOL50.Text : null)); 
                    	}

                    }
                    break;
                case 4 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:699:7: keywordAsIdentifier
                    {
                    	PushFollow(FOLLOW_keywordAsIdentifier_in_dbObjectName2527);
                    	keywordAsIdentifier51 = keywordAsIdentifier();
                    	state.followingStackPointer--;
                    	if (state.failed) return ;
                    	if ( (state.backtracking==0) )
                    	{
                    	   ((dbObject_scope)dbObject_stack.Peek()).sbuf.Append(((keywordAsIdentifier51 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(keywordAsIdentifier51.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(keywordAsIdentifier51.Start)) : null)); 
                    	}

                    }
                    break;

            }
            if ( (state.backtracking==0) )
            {
               ((dbObject_scope)dbObject_stack.Peek()).sbuf.Append(':'); 
            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 31, dbObjectName_StartIndex); 
            }
        }
        return ;
    }
    // $ANTLR end "dbObjectName"

    protected class dbObject_scope 
    {
        protected internal StringBuilder sbuf;
    }
    protected Stack dbObject_stack = new Stack();

    public class dbObject_return : TreeRuleReturnScope
    {
        public String[] obj;
    };

    // $ANTLR start "dbObject"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:702:1: dbObject returns [ String[] obj ] : ^( OBJECT ( dbObjectName )+ ) ;
    public SqlResolve.dbObject_return dbObject() // throws RecognitionException [1]
    {   
        dbObject_stack.Push(new dbObject_scope());
        SqlResolve.dbObject_return retval = new SqlResolve.dbObject_return();
        retval.Start = input.LT(1);
        int dbObject_StartIndex = input.Index();
         ((dbObject_scope)dbObject_stack.Peek()).sbuf =  new StringBuilder(); 
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 32) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:718:5: ( ^( OBJECT ( dbObjectName )+ ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:718:7: ^( OBJECT ( dbObjectName )+ )
            {
            	Match(input,OBJECT,FOLLOW_OBJECT_in_dbObject2577); if (state.failed) return retval;

            	Match(input, Token.DOWN, null); if (state.failed) return retval;
            	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:718:16: ( dbObjectName )+
            	int cnt50 = 0;
            	do 
            	{
            	    int alt50 = 2;
            	    int LA50_0 = input.LA(1);

            	    if ( (LA50_0 == AUTO || LA50_0 == BASE64 || LA50_0 == BINARY || LA50_0 == CAST || LA50_0 == CONCAT || LA50_0 == CUBE || LA50_0 == ELEMENTS || (LA50_0 >= EXPAND && LA50_0 <= FASTFIRSTROW) || LA50_0 == FORCE || LA50_0 == HASH || LA50_0 == IDENTITYCOL || (LA50_0 >= KEEP && LA50_0 <= KEEPFIXED) || (LA50_0 >= LOOP && LA50_0 <= MERGE) || LA50_0 == NOLOCK || LA50_0 == PAGLOCK || LA50_0 == RAW || (LA50_0 >= READCOMMITED && LA50_0 <= READPAST) || LA50_0 == READUNCOMMITED || (LA50_0 >= REMOTE && LA50_0 <= REPEATABLEREAD) || LA50_0 == ROBUST || LA50_0 == ROLLUP || (LA50_0 >= ROWGUIDCOL && LA50_0 <= ROWLOCK) || LA50_0 == SERIALIZABLE || (LA50_0 >= TABLOCK && LA50_0 <= TABLOCKX) || LA50_0 == TIES || LA50_0 == UPDLOCK || LA50_0 == VIEWS || (LA50_0 >= XLOCK && LA50_0 <= XMLDATA) || (LA50_0 >= NonQuotedIdentifier && LA50_0 <= QuotedIdentifier)) )
            	    {
            	        alt50 = 1;
            	    }


            	    switch (alt50) 
            		{
            			case 1 :
            			    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:0:0: dbObjectName
            			    {
            			    	PushFollow(FOLLOW_dbObjectName_in_dbObject2579);
            			    	dbObjectName();
            			    	state.followingStackPointer--;
            			    	if (state.failed) return retval;

            			    }
            			    break;

            			default:
            			    if ( cnt50 >= 1 ) goto loop50;
            			    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            		            EarlyExitException eee50 =
            		                new EarlyExitException(50, input);
            		            throw eee50;
            	    }
            	    cnt50++;
            	} while (true);

            	loop50:
            		;	// Stops C# compiler whining that label 'loop50' has no statements


            	Match(input, Token.UP, null); if (state.failed) return retval;

            }

            if ( (state.backtracking==0) )
            {

                String[] x = ((dbObject_scope)dbObject_stack.Peek()).sbuf.ToString().Split(new char[]{':'});
                if ( x.Length > 2 ) {
                  //x = Arrays.copyOfRange(x,x.length-2,x.length);
                  String[] y = new String[2];
                  y[0] = x[x.Length - 2];
                  y[1] = x[x.Length - 1];
                  x = y;
                }
                retval.obj =  x;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 32, dbObject_StartIndex); 
            }
            dbObject_stack.Pop();
        }
        return retval;
    }
    // $ANTLR end "dbObject"

    public class stringLiteral_return : TreeRuleReturnScope
    {
    };

    // $ANTLR start "stringLiteral"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:721:1: stringLiteral : ( UnicodeStringLiteral | ASCIIStringLiteral );
    public SqlResolve.stringLiteral_return stringLiteral() // throws RecognitionException [1]
    {   
        SqlResolve.stringLiteral_return retval = new SqlResolve.stringLiteral_return();
        retval.Start = input.LT(1);
        int stringLiteral_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 33) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:722:5: ( UnicodeStringLiteral | ASCIIStringLiteral )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:
            {
            	if ( (input.LA(1) >= UnicodeStringLiteral && input.LA(1) <= ASCIIStringLiteral) ) 
            	{
            	    input.Consume();
            	    state.errorRecovery = false;state.failed = false;
            	}
            	else 
            	{
            	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            	    MismatchedSetException mse = new MismatchedSetException(null,input);
            	    throw mse;
            	}


            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 33, stringLiteral_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "stringLiteral"

    public class identifier_return : TreeRuleReturnScope
    {
        public String result;
    };

    // $ANTLR start "identifier"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:726:1: identifier returns [String result] : ( NonQuotedIdentifier | QuotedIdentifier );
    public SqlResolve.identifier_return identifier() // throws RecognitionException [1]
    {   
        SqlResolve.identifier_return retval = new SqlResolve.identifier_return();
        retval.Start = input.LT(1);
        int identifier_StartIndex = input.Index();
        CommonTree NonQuotedIdentifier52 = null;
        CommonTree QuotedIdentifier53 = null;

        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 34) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:727:5: ( NonQuotedIdentifier | QuotedIdentifier )
            int alt51 = 2;
            int LA51_0 = input.LA(1);

            if ( (LA51_0 == NonQuotedIdentifier) )
            {
                alt51 = 1;
            }
            else if ( (LA51_0 == QuotedIdentifier) )
            {
                alt51 = 2;
            }
            else 
            {
                if ( state.backtracking > 0 ) {state.failed = true; return retval;}
                NoViableAltException nvae_d51s0 =
                    new NoViableAltException("", 51, 0, input);

                throw nvae_d51s0;
            }
            switch (alt51) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:727:7: NonQuotedIdentifier
                    {
                    	NonQuotedIdentifier52=(CommonTree)Match(input,NonQuotedIdentifier,FOLLOW_NonQuotedIdentifier_in_identifier2627); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	          retval.result =  ((NonQuotedIdentifier52 != null) ? NonQuotedIdentifier52.Text : null).ToLower();
                    	      
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:731:7: QuotedIdentifier
                    {
                    	QuotedIdentifier53=(CommonTree)Match(input,QuotedIdentifier,FOLLOW_QuotedIdentifier_in_identifier2641); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{

                    	        String s = ((QuotedIdentifier53 != null) ? QuotedIdentifier53.Text : null);
                    	        s = s.Trim().ToLower();
                    	        bool q = s[0] == '[' || s[0] == '"';
                    	        int start = q ? 1 : 0;
                    	        int end = q ? s.Length - 1 : s.Length;
                    	        retval.result =  s.Substring(start,end);
                    	      
                    	}

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 34, identifier_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "identifier"

    public class constant_return : TreeRuleReturnScope
    {
        public Object result;
    };

    // $ANTLR start "constant"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:742:1: constant returns [Object result] : ( Integer | Real | NULL | stringLiteral | HexLiteral | Currency | ODBCDateTime | systemVariable );
    public SqlResolve.constant_return constant() // throws RecognitionException [1]
    {   
        SqlResolve.constant_return retval = new SqlResolve.constant_return();
        retval.Start = input.LT(1);
        int constant_StartIndex = input.Index();
        CommonTree Integer54 = null;
        CommonTree Real55 = null;
        CommonTree HexLiteral57 = null;
        SqlResolve.stringLiteral_return stringLiteral56 = default(SqlResolve.stringLiteral_return);

        SqlResolve.systemVariable_return systemVariable58 = default(SqlResolve.systemVariable_return);


        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 35) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:743:5: ( Integer | Real | NULL | stringLiteral | HexLiteral | Currency | ODBCDateTime | systemVariable )
            int alt52 = 8;
            switch ( input.LA(1) ) 
            {
            case Integer:
            	{
                alt52 = 1;
                }
                break;
            case Real:
            	{
                alt52 = 2;
                }
                break;
            case NULL:
            	{
                alt52 = 3;
                }
                break;
            case UnicodeStringLiteral:
            case ASCIIStringLiteral:
            	{
                alt52 = 4;
                }
                break;
            case HexLiteral:
            	{
                alt52 = 5;
                }
                break;
            case Currency:
            	{
                alt52 = 6;
                }
                break;
            case ODBCDateTime:
            	{
                alt52 = 7;
                }
                break;
            case F_CONNECTIONS:
            case F_CPU_BUSY:
            case F_CURSOR_ROWS:
            case F_DATEFIRST:
            case F_DBTS:
            case F_ERROR:
            case F_FETCH_STATUS:
            case F_IDENTITY:
            case F_IDLE:
            case F_IO_BUSY:
            case F_LANGID:
            case F_LANGUAGE:
            case F_LOCK_TIMEOUT:
            case F_MAX_CONNECTIONS:
            case F_MAX_PRECISION:
            case F_NESTLEVEL:
            case F_OPTIONS:
            case F_PACK_RECEIVED:
            case F_PACK_SENT:
            case F_PACKET_ERRORS:
            case F_PROCID:
            case F_REMSERVER:
            case F_ROWCOUNT:
            case F_SERVERNAME:
            case F_SERVICENAME:
            case F_SPID:
            case F_TEXTSIZE:
            case F_TIMETICKS:
            case F_TOTAL_ERRORS:
            case F_TOTAL_READ:
            case F_TOTAL_WRITE:
            case F_TRANCOUNT:
            case F_VERSION:
            	{
                alt52 = 8;
                }
                break;
            	default:
            	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            	    NoViableAltException nvae_d52s0 =
            	        new NoViableAltException("", 52, 0, input);

            	    throw nvae_d52s0;
            }

            switch (alt52) 
            {
                case 1 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:743:7: Integer
                    {
                    	Integer54=(CommonTree)Match(input,Integer,FOLLOW_Integer_in_constant2668); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{
                    	   retval.result =  Int32.Parse(((Integer54 != null) ? Integer54.Text : null)); 
                    	}

                    }
                    break;
                case 2 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:745:7: Real
                    {
                    	Real55=(CommonTree)Match(input,Real,FOLLOW_Real_in_constant2683); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{
                    	   retval.result =  double.Parse(((Real55 != null) ? Real55.Text : null)); 
                    	}

                    }
                    break;
                case 3 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:747:7: NULL
                    {
                    	Match(input,NULL,FOLLOW_NULL_in_constant2698); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{
                    	   retval.result =  null; 
                    	}

                    }
                    break;
                case 4 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:749:7: stringLiteral
                    {
                    	PushFollow(FOLLOW_stringLiteral_in_constant2713);
                    	stringLiteral56 = stringLiteral();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{
                    	   retval.result =  ((stringLiteral56 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(stringLiteral56.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(stringLiteral56.Start)) : null); 
                    	}

                    }
                    break;
                case 5 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:751:7: HexLiteral
                    {
                    	HexLiteral57=(CommonTree)Match(input,HexLiteral,FOLLOW_HexLiteral_in_constant2727); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{
                    	   retval.result =  Int32.Parse(((HexLiteral57 != null) ? HexLiteral57.Text : null),System.Globalization.NumberStyles.HexNumber); 
                    	}

                    }
                    break;
                case 6 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:753:7: Currency
                    {
                    	Match(input,Currency,FOLLOW_Currency_in_constant2742); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{
                    	   retval.result =  null; 
                    	}

                    }
                    break;
                case 7 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:755:7: ODBCDateTime
                    {
                    	Match(input,ODBCDateTime,FOLLOW_ODBCDateTime_in_constant2757); if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{
                    	   retval.result =  null; 
                    	}

                    }
                    break;
                case 8 :
                    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:757:7: systemVariable
                    {
                    	PushFollow(FOLLOW_systemVariable_in_constant2772);
                    	systemVariable58 = systemVariable();
                    	state.followingStackPointer--;
                    	if (state.failed) return retval;
                    	if ( (state.backtracking==0) )
                    	{
                    	   retval.result =  ((systemVariable58 != null) ? input.TokenStream.ToString(
                    	    input.TreeAdaptor.GetTokenStartIndex(systemVariable58.Start),
                    	    input.TreeAdaptor.GetTokenStopIndex(systemVariable58.Start)) : null); 
                    	}

                    }
                    break;

            }
        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 35, constant_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "constant"

    public class parameterlessFunction_return : TreeRuleReturnScope
    {
    };

    // $ANTLR start "parameterlessFunction"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:765:1: parameterlessFunction : ( CURRENT_TIMESTAMP | CURRENT_USER | SESSION_USER | SYSTEM_USER );
    public SqlResolve.parameterlessFunction_return parameterlessFunction() // throws RecognitionException [1]
    {   
        SqlResolve.parameterlessFunction_return retval = new SqlResolve.parameterlessFunction_return();
        retval.Start = input.LT(1);
        int parameterlessFunction_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 36) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:766:5: ( CURRENT_TIMESTAMP | CURRENT_USER | SESSION_USER | SYSTEM_USER )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:
            {
            	if ( (input.LA(1) >= CURRENT_TIMESTAMP && input.LA(1) <= CURRENT_USER) || input.LA(1) == SESSION_USER || input.LA(1) == SYSTEM_USER ) 
            	{
            	    input.Consume();
            	    state.errorRecovery = false;state.failed = false;
            	}
            	else 
            	{
            	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            	    MismatchedSetException mse = new MismatchedSetException(null,input);
            	    throw mse;
            	}


            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 36, parameterlessFunction_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "parameterlessFunction"

    public class systemVariable_return : TreeRuleReturnScope
    {
    };

    // $ANTLR start "systemVariable"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:773:1: systemVariable : ( F_CONNECTIONS | F_CPU_BUSY | F_CURSOR_ROWS | F_DATEFIRST | F_DBTS | F_ERROR | F_FETCH_STATUS | F_IDENTITY | F_IDLE | F_IO_BUSY | F_LANGID | F_LANGUAGE | F_LOCK_TIMEOUT | F_MAX_CONNECTIONS | F_MAX_PRECISION | F_NESTLEVEL | F_OPTIONS | F_PACK_RECEIVED | F_PACK_SENT | F_PACKET_ERRORS | F_PROCID | F_REMSERVER | F_ROWCOUNT | F_SERVERNAME | F_SERVICENAME | F_SPID | F_TEXTSIZE | F_TIMETICKS | F_TOTAL_ERRORS | F_TOTAL_READ | F_TOTAL_WRITE | F_TRANCOUNT | F_VERSION );
    public SqlResolve.systemVariable_return systemVariable() // throws RecognitionException [1]
    {   
        SqlResolve.systemVariable_return retval = new SqlResolve.systemVariable_return();
        retval.Start = input.LT(1);
        int systemVariable_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 37) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:774:5: ( F_CONNECTIONS | F_CPU_BUSY | F_CURSOR_ROWS | F_DATEFIRST | F_DBTS | F_ERROR | F_FETCH_STATUS | F_IDENTITY | F_IDLE | F_IO_BUSY | F_LANGID | F_LANGUAGE | F_LOCK_TIMEOUT | F_MAX_CONNECTIONS | F_MAX_PRECISION | F_NESTLEVEL | F_OPTIONS | F_PACK_RECEIVED | F_PACK_SENT | F_PACKET_ERRORS | F_PROCID | F_REMSERVER | F_ROWCOUNT | F_SERVERNAME | F_SERVICENAME | F_SPID | F_TEXTSIZE | F_TIMETICKS | F_TOTAL_ERRORS | F_TOTAL_READ | F_TOTAL_WRITE | F_TRANCOUNT | F_VERSION )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:
            {
            	if ( (input.LA(1) >= F_CONNECTIONS && input.LA(1) <= F_VERSION) ) 
            	{
            	    input.Consume();
            	    state.errorRecovery = false;state.failed = false;
            	}
            	else 
            	{
            	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            	    MismatchedSetException mse = new MismatchedSetException(null,input);
            	    throw mse;
            	}


            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 37, systemVariable_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "systemVariable"

    public class keywordAsIdentifier_return : TreeRuleReturnScope
    {
    };

    // $ANTLR start "keywordAsIdentifier"
    // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:811:1: keywordAsIdentifier : ( AUTO | BASE64 | BINARY | CAST | CONCAT | CUBE | ELEMENTS | EXPAND | EXPLICIT | FAST | FASTFIRSTROW | FORCE | HASH | KEEP | KEEPFIXED | LOOP | MAXDOP | MERGE | NOLOCK | PAGLOCK | RAW | READCOMMITED | READPAST | READUNCOMMITED | REMOTE | REPEATABLEREAD | ROBUST | ROLLUP | ROWLOCK | SERIALIZABLE | TABLOCK | TABLOCKX | TIES | UPDLOCK | VIEWS | XLOCK | XML | XMLDATA ) ;
    public SqlResolve.keywordAsIdentifier_return keywordAsIdentifier() // throws RecognitionException [1]
    {   
        SqlResolve.keywordAsIdentifier_return retval = new SqlResolve.keywordAsIdentifier_return();
        retval.Start = input.LT(1);
        int keywordAsIdentifier_StartIndex = input.Index();
        try 
    	{
    	    if ( (state.backtracking > 0) && AlreadyParsedRule(input, 38) ) 
    	    {
    	    	return retval; 
    	    }
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:812:5: ( ( AUTO | BASE64 | BINARY | CAST | CONCAT | CUBE | ELEMENTS | EXPAND | EXPLICIT | FAST | FASTFIRSTROW | FORCE | HASH | KEEP | KEEPFIXED | LOOP | MAXDOP | MERGE | NOLOCK | PAGLOCK | RAW | READCOMMITED | READPAST | READUNCOMMITED | REMOTE | REPEATABLEREAD | ROBUST | ROLLUP | ROWLOCK | SERIALIZABLE | TABLOCK | TABLOCKX | TIES | UPDLOCK | VIEWS | XLOCK | XML | XMLDATA ) )
            // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:813:5: ( AUTO | BASE64 | BINARY | CAST | CONCAT | CUBE | ELEMENTS | EXPAND | EXPLICIT | FAST | FASTFIRSTROW | FORCE | HASH | KEEP | KEEPFIXED | LOOP | MAXDOP | MERGE | NOLOCK | PAGLOCK | RAW | READCOMMITED | READPAST | READUNCOMMITED | REMOTE | REPEATABLEREAD | ROBUST | ROLLUP | ROWLOCK | SERIALIZABLE | TABLOCK | TABLOCKX | TIES | UPDLOCK | VIEWS | XLOCK | XML | XMLDATA )
            {
            	if ( input.LA(1) == AUTO || input.LA(1) == BASE64 || input.LA(1) == BINARY || input.LA(1) == CAST || input.LA(1) == CONCAT || input.LA(1) == CUBE || input.LA(1) == ELEMENTS || (input.LA(1) >= EXPAND && input.LA(1) <= FASTFIRSTROW) || input.LA(1) == FORCE || input.LA(1) == HASH || (input.LA(1) >= KEEP && input.LA(1) <= KEEPFIXED) || (input.LA(1) >= LOOP && input.LA(1) <= MERGE) || input.LA(1) == NOLOCK || input.LA(1) == PAGLOCK || input.LA(1) == RAW || (input.LA(1) >= READCOMMITED && input.LA(1) <= READPAST) || input.LA(1) == READUNCOMMITED || (input.LA(1) >= REMOTE && input.LA(1) <= REPEATABLEREAD) || input.LA(1) == ROBUST || input.LA(1) == ROLLUP || input.LA(1) == ROWLOCK || input.LA(1) == SERIALIZABLE || (input.LA(1) >= TABLOCK && input.LA(1) <= TABLOCKX) || input.LA(1) == TIES || input.LA(1) == UPDLOCK || input.LA(1) == VIEWS || (input.LA(1) >= XLOCK && input.LA(1) <= XMLDATA) ) 
            	{
            	    input.Consume();
            	    state.errorRecovery = false;state.failed = false;
            	}
            	else 
            	{
            	    if ( state.backtracking > 0 ) {state.failed = true; return retval;}
            	    MismatchedSetException mse = new MismatchedSetException(null,input);
            	    throw mse;
            	}


            }

        }

        catch (RecognitionException e) {
            throw e;
        }
        finally 
    	{
            if ( state.backtracking > 0 ) 
            {
            	Memoize(input, 38, keywordAsIdentifier_StartIndex); 
            }
        }
        return retval;
    }
    // $ANTLR end "keywordAsIdentifier"

    // $ANTLR start "synpred59_SqlResolve"
    public void synpred59_SqlResolve_fragment() {
        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:364:7: ( ^( SELECTITEM tableColumns ) )
        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:364:7: ^( SELECTITEM tableColumns )
        {
        	Match(input,SELECTITEM,FOLLOW_SELECTITEM_in_synpred59_SqlResolve1199); if (state.failed) return ;

        	Match(input, Token.DOWN, null); if (state.failed) return ;
        	PushFollow(FOLLOW_tableColumns_in_synpred59_SqlResolve1201);
        	tableColumns();
        	state.followingStackPointer--;
        	if (state.failed) return ;

        	Match(input, Token.UP, null); if (state.failed) return ;

        }
    }
    // $ANTLR end "synpred59_SqlResolve"

    // $ANTLR start "synpred61_SqlResolve"
    public void synpred61_SqlResolve_fragment() {
        String a = default(String);


        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:369:7: ( ^( SELECTITEM dbObject (a= alias1 )? ) )
        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:369:7: ^( SELECTITEM dbObject (a= alias1 )? )
        {
        	Match(input,SELECTITEM,FOLLOW_SELECTITEM_in_synpred61_SqlResolve1217); if (state.failed) return ;

        	Match(input, Token.DOWN, null); if (state.failed) return ;
        	PushFollow(FOLLOW_dbObject_in_synpred61_SqlResolve1219);
        	dbObject();
        	state.followingStackPointer--;
        	if (state.failed) return ;
        	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:369:29: (a= alias1 )?
        	int alt63 = 2;
        	int LA63_0 = input.LA(1);

        	if ( (LA63_0 == ALIAS) )
        	{
        	    alt63 = 1;
        	}
        	switch (alt63) 
        	{
        	    case 1 :
        	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:369:30: a= alias1
        	        {
        	        	PushFollow(FOLLOW_alias1_in_synpred61_SqlResolve1224);
        	        	a = alias1();
        	        	state.followingStackPointer--;
        	        	if (state.failed) return ;

        	        }
        	        break;

        	}


        	Match(input, Token.UP, null); if (state.failed) return ;

        }
    }
    // $ANTLR end "synpred61_SqlResolve"

    // $ANTLR start "synpred63_SqlResolve"
    public void synpred63_SqlResolve_fragment() {
        String a = default(String);


        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:385:7: ( ^( SELECTITEM subQuery (a= alias1 )? ) )
        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:385:7: ^( SELECTITEM subQuery (a= alias1 )? )
        {
        	Match(input,SELECTITEM,FOLLOW_SELECTITEM_in_synpred63_SqlResolve1242); if (state.failed) return ;

        	Match(input, Token.DOWN, null); if (state.failed) return ;
        	PushFollow(FOLLOW_subQuery_in_synpred63_SqlResolve1244);
        	subQuery();
        	state.followingStackPointer--;
        	if (state.failed) return ;
        	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:385:29: (a= alias1 )?
        	int alt64 = 2;
        	int LA64_0 = input.LA(1);

        	if ( (LA64_0 == ALIAS) )
        	{
        	    alt64 = 1;
        	}
        	switch (alt64) 
        	{
        	    case 1 :
        	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:385:30: a= alias1
        	        {
        	        	PushFollow(FOLLOW_alias1_in_synpred63_SqlResolve1249);
        	        	a = alias1();
        	        	state.followingStackPointer--;
        	        	if (state.failed) return ;

        	        }
        	        break;

        	}


        	Match(input, Token.UP, null); if (state.failed) return ;

        }
    }
    // $ANTLR end "synpred63_SqlResolve"

    // $ANTLR start "synpred65_SqlResolve"
    public void synpred65_SqlResolve_fragment() {
        String a = default(String);


        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:406:7: ( ^( SELECTITEM function (a= alias1 )? ) )
        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:406:7: ^( SELECTITEM function (a= alias1 )? )
        {
        	Match(input,SELECTITEM,FOLLOW_SELECTITEM_in_synpred65_SqlResolve1267); if (state.failed) return ;

        	Match(input, Token.DOWN, null); if (state.failed) return ;
        	PushFollow(FOLLOW_function_in_synpred65_SqlResolve1269);
        	function();
        	state.followingStackPointer--;
        	if (state.failed) return ;
        	// C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:406:29: (a= alias1 )?
        	int alt65 = 2;
        	int LA65_0 = input.LA(1);

        	if ( (LA65_0 == ALIAS) )
        	{
        	    alt65 = 1;
        	}
        	switch (alt65) 
        	{
        	    case 1 :
        	        // C:\\Users\\gbc3\\Documents\\Visual Studio 2010\\Projects\\SqlAntlr\\SqlAntlr\\SqlResolve.g:406:30: a= alias1
        	        {
        	        	PushFollow(FOLLOW_alias1_in_synpred65_SqlResolve1274);
        	        	a = alias1();
        	        	state.followingStackPointer--;
        	        	if (state.failed) return ;

        	        }
        	        break;

        	}


        	Match(input, Token.UP, null); if (state.failed) return ;

        }
    }
    // $ANTLR end "synpred65_SqlResolve"

    // Delegated rules

   	public bool synpred61_SqlResolve() 
   	{
   	    state.backtracking++;
   	    int start = input.Mark();
   	    try 
   	    {
   	        synpred61_SqlResolve_fragment(); // can never throw exception
   	    }
   	    catch (RecognitionException re) 
   	    {
   	        Console.Error.WriteLine("impossible: "+re);
   	    }
   	    bool success = !state.failed;
   	    input.Rewind(start);
   	    state.backtracking--;
   	    state.failed = false;
   	    return success;
   	}
   	public bool synpred63_SqlResolve() 
   	{
   	    state.backtracking++;
   	    int start = input.Mark();
   	    try 
   	    {
   	        synpred63_SqlResolve_fragment(); // can never throw exception
   	    }
   	    catch (RecognitionException re) 
   	    {
   	        Console.Error.WriteLine("impossible: "+re);
   	    }
   	    bool success = !state.failed;
   	    input.Rewind(start);
   	    state.backtracking--;
   	    state.failed = false;
   	    return success;
   	}
   	public bool synpred59_SqlResolve() 
   	{
   	    state.backtracking++;
   	    int start = input.Mark();
   	    try 
   	    {
   	        synpred59_SqlResolve_fragment(); // can never throw exception
   	    }
   	    catch (RecognitionException re) 
   	    {
   	        Console.Error.WriteLine("impossible: "+re);
   	    }
   	    bool success = !state.failed;
   	    input.Rewind(start);
   	    state.backtracking--;
   	    state.failed = false;
   	    return success;
   	}
   	public bool synpred65_SqlResolve() 
   	{
   	    state.backtracking++;
   	    int start = input.Mark();
   	    try 
   	    {
   	        synpred65_SqlResolve_fragment(); // can never throw exception
   	    }
   	    catch (RecognitionException re) 
   	    {
   	        Console.Error.WriteLine("impossible: "+re);
   	    }
   	    bool success = !state.failed;
   	    input.Rewind(start);
   	    state.backtracking--;
   	    state.failed = false;
   	    return success;
   	}


	private void InitializeCyclicDFAs()
	{
	}

 

    public static readonly BitSet FOLLOW_QUERY_in_subQuery97 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_ARRAY_in_array132 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_argExpr_in_array134 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_dbObject_in_argExpr184 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_subQuery_in_argExpr198 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_function_in_argExpr212 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_CASE_in_argExpr227 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr229 = new BitSet(new ulong[]{0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000008000000000UL});
    public static readonly BitSet FOLLOW_resolve_caseWhen_in_argExpr232 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000004000000UL,0x0000000000000000UL,0x0000008000000000UL});
    public static readonly BitSet FOLLOW_resolve_caseElse_in_argExpr235 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_CAST_in_argExpr252 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr254 = new BitSet(new ulong[]{0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000003000000000UL});
    public static readonly BitSet FOLLOW_identifier_in_argExpr256 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000100000UL});
    public static readonly BitSet FOLLOW_Integer_in_argExpr259 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000100000UL});
    public static readonly BitSet FOLLOW_Integer_in_argExpr261 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_parameterlessFunction_in_argExpr279 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_CONSTANT_in_argExpr294 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_constant_in_argExpr296 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_Variable_in_argExpr311 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_PLUS_in_argExpr326 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr328 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr330 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_MINUS_in_argExpr346 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr348 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr350 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_STAR_in_argExpr366 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr368 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr370 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_DIVIDE_in_argExpr386 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr388 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr390 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_MOD_in_argExpr406 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr408 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr410 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_AMPERSAND_in_argExpr426 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr428 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr430 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_BITWISEOR_in_argExpr446 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr448 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr450 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_BITWISEXOR_in_argExpr466 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr468 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr470 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_TILDE_in_argExpr486 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr488 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SIGN_PLUS_in_argExpr504 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr506 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SIGN_MINUS_in_argExpr522 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_argExpr524 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_array_in_argExpr539 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_argExpr_in_argExpr1566 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_AND_in_pred591 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_OR_in_pred605 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_NOT_in_pred619 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_IS_in_pred631 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_NULL_in_pred635 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_LIKE_in_pred645 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_BETWEEN_in_pred659 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_IN_in_pred675 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_EXISTS_in_pred689 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_ASSIGNEQUAL_in_pred701 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_NOTEQUAL1_in_pred715 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_NOTEQUAL2_in_pred729 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_LESSTHANOREQUALTO1_in_pred743 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_LESSTHANOREQUALTO2_in_pred757 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_LESSTHAN_in_pred771 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_GREATERTHANOREQUALTO1_in_pred785 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_GREATERTHANOREQUALTO2_in_pred799 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_GREATERTHAN_in_pred813 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_VARASSIGN_in_varAssign836 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_Variable_in_varAssign838 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_argExpr1_in_varAssign840 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ARG_in_functionArg887 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_ALL_in_functionArg892 = new BitSet(new ulong[]{0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000200000UL});
    public static readonly BitSet FOLLOW_DISTINCT_in_functionArg896 = new BitSet(new ulong[]{0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000200000UL});
    public static readonly BitSet FOLLOW_STAR_in_functionArg900 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ARG_in_functionArg916 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_ALL_in_functionArg921 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_DISTINCT_in_functionArg925 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_argExpr_in_functionArg929 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_ARG_in_functionArg947 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_varAssign_in_functionArg949 = new BitSet(new ulong[]{0x0000000080000008UL});
    public static readonly BitSet FOLLOW_FUNCTION_in_function997 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_LEFT_in_function1000 = new BitSet(new ulong[]{0x0000000000000020UL});
    public static readonly BitSet FOLLOW_RIGHT_in_function1002 = new BitSet(new ulong[]{0x0000000000000020UL});
    public static readonly BitSet FOLLOW_identifier_in_function1004 = new BitSet(new ulong[]{0x0000000000000020UL});
    public static readonly BitSet FOLLOW_functionArg_in_function1007 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_FUNCTION_in_function1023 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_identifier_in_function1025 = new BitSet(new ulong[]{0x0000000000004000UL});
    public static readonly BitSet FOLLOW_NOARG_in_function1027 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ALIAS_in_alias11059 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_identifier_in_alias11061 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ALIAS_in_alias11078 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_stringLiteral_in_alias11080 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ALIAS_in_alias11096 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_keywordAsIdentifier_in_alias11098 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_TOP_in_topKclause1126 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_PERCENT_in_topKclause1130 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000080000UL});
    public static readonly BitSet FOLLOW_TIES_in_topKclause1133 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_TABLECOLS_in_tableColumns1157 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_dbObject_in_tableColumns1159 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_STAR_in_selectItem1184 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_SELECTITEM_in_selectItem1199 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_tableColumns_in_selectItem1201 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SELECTITEM_in_selectItem1217 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_dbObject_in_selectItem1219 = new BitSet(new ulong[]{0x0000000000000018UL});
    public static readonly BitSet FOLLOW_alias1_in_selectItem1224 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SELECTITEM_in_selectItem1242 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_subQuery_in_selectItem1244 = new BitSet(new ulong[]{0x0000000000000018UL});
    public static readonly BitSet FOLLOW_alias1_in_selectItem1249 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SELECTITEM_in_selectItem1267 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_function_in_selectItem1269 = new BitSet(new ulong[]{0x0000000000000018UL});
    public static readonly BitSet FOLLOW_alias1_in_selectItem1274 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SELECTITEM_in_selectItem1292 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_argExpr_in_selectItem1294 = new BitSet(new ulong[]{0x0000000000000018UL});
    public static readonly BitSet FOLLOW_alias1_in_selectItem1300 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SELECT_in_selectClause1327 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_set_in_selectClause1329 = new BitSet(new ulong[]{0x0000000000200000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000200000UL,0x0000000000200000UL});
    public static readonly BitSet FOLLOW_topKclause_in_selectClause1336 = new BitSet(new ulong[]{0x0000000000200000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000200000UL,0x0000000000200000UL});
    public static readonly BitSet FOLLOW_selectItem_in_selectClause1339 = new BitSet(new ulong[]{0x0000000000200008UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000200000UL,0x0000000000200000UL});
    public static readonly BitSet FOLLOW_TYPE_in_joinType1362 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_CROSS_in_joinType1364 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_TYPE_in_joinType1374 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_INNER_in_joinType1376 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_TYPE_in_joinType1386 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_set_in_joinType1388 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000000000000UL,0x0000000200000000UL});
    public static readonly BitSet FOLLOW_OUTER_in_joinType1396 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_HINT_in_joinHint1416 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_ON_in_joinOn1437 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_pred_in_joinOn1439 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_TABLE_in_subTableSource1464 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_dbObject_in_subTableSource1466 = new BitSet(new ulong[]{0x0000000000000018UL});
    public static readonly BitSet FOLLOW_alias1_in_subTableSource1471 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_TABLE_in_subTableSource1490 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_subQuery_in_subTableSource1492 = new BitSet(new ulong[]{0x0000000000000010UL});
    public static readonly BitSet FOLLOW_alias1_in_subTableSource1497 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_JOIN_in_subTableSource1524 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_joinType_in_subTableSource1526 = new BitSet(new ulong[]{0x0000000028002000UL,0x0000000000000000UL,0x0000000000000008UL});
    public static readonly BitSet FOLLOW_joinHint_in_subTableSource1529 = new BitSet(new ulong[]{0x0000000028002000UL,0x0000000000000000UL,0x0000000000000008UL});
    public static readonly BitSet FOLLOW_subTableSource_in_subTableSource1532 = new BitSet(new ulong[]{0x0000000028002000UL,0x0000000000000000UL,0x0000000000000008UL});
    public static readonly BitSet FOLLOW_subTableSource_in_subTableSource1534 = new BitSet(new ulong[]{0x0000000000000000UL,0x0000000000000000UL,0x0000000001000000UL});
    public static readonly BitSet FOLLOW_joinOn_in_subTableSource1536 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_TABLEFUNCTION_in_subTableSource1546 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_alias1_in_subTableSource1550 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_subTableSource_in_tableSource1575 = new BitSet(new ulong[]{0x0000000028002002UL,0x0000000000000000UL,0x0000000000000008UL});
    public static readonly BitSet FOLLOW_FROM_in_fromClause1594 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_tableSource_in_fromClause1596 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_WHERE_in_whereClause1618 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_predicate_in_whereClause1620 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_GROUPBY_in_groupByClause1664 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_ALL_in_groupByClause1668 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_argExpr_in_groupByClause1671 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_HAVING_in_havingClause1695 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_predicate_in_havingClause1697 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ORDER_in_orderByItem1743 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_argExpr1_in_orderByItem1745 = new BitSet(new ulong[]{0x0000004000000008UL,0x0000000000040000UL});
    public static readonly BitSet FOLLOW_ASC_in_orderByItem1750 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_DESC_in_orderByItem1754 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ORDERBY_in_orderByClause1803 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_orderByItem_in_orderByClause1805 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000000000000UL,0x0000000100000000UL});
    public static readonly BitSet FOLLOW_WHEN_in_resolve_caseWhen1831 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_caseWhen1833 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_caseWhen1835 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_WHEN_in_resolve_caseWhen1845 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_predicate_in_resolve_caseWhen1847 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_caseWhen1849 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ELSE_in_resolve_caseElse1868 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_caseElse1870 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ALL_in_resolve_setPred1889 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_setPred1891 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SOME_in_resolve_setPred1901 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_setPred1903 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ANY_in_resolve_setPred1913 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_setPred1915 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_setPred1924 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_AND_in_resolve_predicate1943 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_predicate_in_resolve_predicate1945 = new BitSet(new ulong[]{0x0000100800000000UL,0x1000000200000000UL,0x0000000080080204UL,0x0000000000000000UL,0x0007F80001000000UL});
    public static readonly BitSet FOLLOW_resolve_predicate_in_resolve_predicate1947 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_OR_in_resolve_predicate1957 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_predicate_in_resolve_predicate1959 = new BitSet(new ulong[]{0x0000100800000000UL,0x1000000200000000UL,0x0000000080080204UL,0x0000000000000000UL,0x0007F80001000000UL});
    public static readonly BitSet FOLLOW_resolve_predicate_in_resolve_predicate1961 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_NOT_in_resolve_predicate1971 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_predicate_in_resolve_predicate1973 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_IS_in_resolve_predicate1983 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_predicate1985 = new BitSet(new ulong[]{0x0000000000000000UL,0x0000000000000000UL,0x0000000000100000UL});
    public static readonly BitSet FOLLOW_NULL_in_resolve_predicate1987 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_LIKE_in_resolve_predicate1997 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_predicate1999 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_predicate2001 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_BETWEEN_in_resolve_predicate2011 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_predicate2013 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_predicate2015 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_predicate2017 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_IN_in_resolve_predicate2027 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_predicate2029 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_predicate2031 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_EXISTS_in_resolve_predicate2041 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_predicate2043 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_ASSIGNEQUAL_in_resolve_predicate2053 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2055 = new BitSet(new ulong[]{0x0018001200C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000005100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2057 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_NOTEQUAL1_in_resolve_predicate2067 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2069 = new BitSet(new ulong[]{0x0018001200C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000005100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2071 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_NOTEQUAL2_in_resolve_predicate2081 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2083 = new BitSet(new ulong[]{0x0018001200C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000005100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2085 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_LESSTHANOREQUALTO1_in_resolve_predicate2095 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2097 = new BitSet(new ulong[]{0x0018001200C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000005100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2099 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_LESSTHANOREQUALTO2_in_resolve_predicate2109 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2111 = new BitSet(new ulong[]{0x0018001200C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000005100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2113 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_LESSTHAN_in_resolve_predicate2123 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2125 = new BitSet(new ulong[]{0x0018001200C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000005100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2127 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_GREATERTHANOREQUALTO1_in_resolve_predicate2137 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2139 = new BitSet(new ulong[]{0x0018001200C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000005100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2141 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_GREATERTHANOREQUALTO2_in_resolve_predicate2151 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2153 = new BitSet(new ulong[]{0x0018001200C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000005100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2155 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_GREATERTHAN_in_resolve_predicate2165 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2167 = new BitSet(new ulong[]{0x0018001200C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000005100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_setPred_in_resolve_predicate2169 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_array_in_resolve_array2189 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_dbObject_in_resolve_expr2206 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_subQuery_in_resolve_expr2220 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_function_in_resolve_expr2234 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_CASE_in_resolve_expr2249 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2251 = new BitSet(new ulong[]{0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000008000000000UL});
    public static readonly BitSet FOLLOW_resolve_caseWhen_in_resolve_expr2254 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000004000000UL,0x0000000000000000UL,0x0000008000000000UL});
    public static readonly BitSet FOLLOW_resolve_caseElse_in_resolve_expr2257 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_CAST_in_resolve_expr2268 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2270 = new BitSet(new ulong[]{0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000003000000000UL});
    public static readonly BitSet FOLLOW_identifier_in_resolve_expr2272 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000100000UL});
    public static readonly BitSet FOLLOW_Integer_in_resolve_expr2275 = new BitSet(new ulong[]{0x0000000000000008UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000000000UL,0x0000000000100000UL});
    public static readonly BitSet FOLLOW_Integer_in_resolve_expr2277 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_parameterlessFunction_in_resolve_expr2290 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_CONSTANT_in_resolve_expr2299 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_constant_in_resolve_expr2301 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_Variable_in_resolve_expr2316 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_PLUS_in_resolve_expr2325 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2327 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2329 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_MINUS_in_resolve_expr2339 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2341 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2343 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_STAR_in_resolve_expr2353 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2355 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2357 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_DIVIDE_in_resolve_expr2367 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2369 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2371 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_MOD_in_resolve_expr2381 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2383 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2385 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_AMPERSAND_in_resolve_expr2395 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2397 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2399 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_BITWISEOR_in_resolve_expr2409 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2411 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2413 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_BITWISEXOR_in_resolve_expr2423 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2425 = new BitSet(new ulong[]{0x0018000000C28148UL,0x0002000000000300UL,0x0000000000000000UL,0x0000000000004100UL,0x00000401FC600000UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2427 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_TILDE_in_resolve_expr2437 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2439 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SIGN_PLUS_in_resolve_expr2449 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2451 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SIGN_MINUS_in_resolve_expr2461 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_resolve_expr_in_resolve_expr2463 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_resolve_array_in_resolve_expr2472 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_identifier_in_dbObjectName2497 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_IDENTITYCOL_in_dbObjectName2507 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_ROWGUIDCOL_in_dbObjectName2517 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_keywordAsIdentifier_in_dbObjectName2527 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_OBJECT_in_dbObject2577 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_dbObjectName_in_dbObject2579 = new BitSet(new ulong[]{0x2010250000000008UL,0x0420087802000010UL,0xA065A00800027030UL,0x0000702080098086UL,0x0000003000000000UL});
    public static readonly BitSet FOLLOW_set_in_stringLiteral0 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_NonQuotedIdentifier_in_identifier2627 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_QuotedIdentifier_in_identifier2641 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_Integer_in_constant2668 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_Real_in_constant2683 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_NULL_in_constant2698 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_stringLiteral_in_constant2713 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_HexLiteral_in_constant2727 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_Currency_in_constant2742 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_ODBCDateTime_in_constant2757 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_systemVariable_in_constant2772 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_set_in_parameterlessFunction0 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_set_in_systemVariable0 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_set_in_keywordAsIdentifier3134 = new BitSet(new ulong[]{0x0000000000000002UL});
    public static readonly BitSet FOLLOW_SELECTITEM_in_synpred59_SqlResolve1199 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_tableColumns_in_synpred59_SqlResolve1201 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SELECTITEM_in_synpred61_SqlResolve1217 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_dbObject_in_synpred61_SqlResolve1219 = new BitSet(new ulong[]{0x0000000000000018UL});
    public static readonly BitSet FOLLOW_alias1_in_synpred61_SqlResolve1224 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SELECTITEM_in_synpred63_SqlResolve1242 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_subQuery_in_synpred63_SqlResolve1244 = new BitSet(new ulong[]{0x0000000000000018UL});
    public static readonly BitSet FOLLOW_alias1_in_synpred63_SqlResolve1249 = new BitSet(new ulong[]{0x0000000000000008UL});
    public static readonly BitSet FOLLOW_SELECTITEM_in_synpred65_SqlResolve1267 = new BitSet(new ulong[]{0x0000000000000004UL});
    public static readonly BitSet FOLLOW_function_in_synpred65_SqlResolve1269 = new BitSet(new ulong[]{0x0000000000000018UL});
    public static readonly BitSet FOLLOW_alias1_in_synpred65_SqlResolve1274 = new BitSet(new ulong[]{0x0000000000000008UL});

}
}